[Pythonmac-SIG] Why does all threads block when doing I/O to unreachable network device on Mac OSX?

Read Roberts rroberts at adobe.com
Thu Feb 3 18:58:21 CET 2005


In writing a replacement for tkDialog.askdirname() (needed because 
this is not Kanji -capable on Windows), I needed to work around a 
problem where os.listdir() will block indefinitely when a volume is 
not reachable.  Looking for a cross-platform solution, I tried doing 
the os.lsitdir() within a thread, and then from the main thread, 
calling  getdirThread.join(<some-timeout>), so I can continue without 
waiting for the network time-out.

On Windows this works fine,  for both floppy drives and mapped 
network drives that are not reachable. However, on Mac OS X, if I 
mount a network volume, and then shut-down the network, the entire 
process seems to block:  a print statement in the main thread never 
gets executed, that is right after getdirThread.run()  and before 
getdirThread.join().

Thanks for any advice.


More information about the Pythonmac-SIG mailing list