[Tutor] timeout a routine

arbaro arbaro arbaro at gmail.com
Tue Nov 28 16:25:05 CET 2006


Hello,

I have a small problem with accessing a directory that may or may not exist.

- The program runs from a Linux OS. (though this shouldn't matter)
- A mountpoint /mnt/server may have been made to a windows server with samba.

I would like to find out if a folder on the server is reachable (eg.
/mnt/server/folderOnServer).
When I try to find out if dir exists with
os.path.isdir("/mnt/server/folderOnServer"), python hangs for a very
long time.

Is there a way to run the command
os.path.isdir("/mnt/server/folderOnServer"), and kill the attempt if
it tries for longer then 5 seconds?
Where/what can I use to accomplish something like this?


Thanks,
Arbaro


More information about the Tutor mailing list