copytree with timeout in windows
astan.chee at al.com.au
Tue Jul 7 04:58:24 CEST 2009
I'm trying to modify the copytree function in shutil so that any file
being copied does not take more than 5 minutes (if it does, skip to the
next one). This is what I have so far:
import signal, os
def handler(signum, frame):
print 'Signal handler called with signal', signum
raise IOError, "Couldn't open device!"
def copytree(src, dst):
names = os.listdir(src)
for name in names:
if name in ignored_names:
srcname = os.path.join(src, name)
dstname = os.path.join(dst, name)
copytree(srcname, dstname, symlinks, ignore)
except (IOError, os.error), why:
# catch the Error from the recursive copytree so that we can
# continue with other files
except Error, err:
source = "c:\\testwa\\"
destination = "d:\\testwa\\"
Then I re-read the documentation which said that signal.SIGALRM is
unix/linux only. How do I go about doing this in windows?
Thanks for any help.
More information about the Python-list