J
John Abel
I have a problem, in that the following code is sometimes failing. I am
stat'ing a list of files, but, sometimes, one of the files may be moved
by an external process, after the os.path.exists and before the lstat,
causing the script to fail. My question, is there anything I can do to
speed it up, or put in a trap, to stop the stat from failing?
fileTimes = [ ( os.lstat( os.path.join( rootPath, fileName )
)[stat.ST_MTIME], fileName) for fileName in fileList \
if os.path.exists( os.path.join( rootPath, fileName ) ) ]
I'd appreciate any pointers.
John
stat'ing a list of files, but, sometimes, one of the files may be moved
by an external process, after the os.path.exists and before the lstat,
causing the script to fail. My question, is there anything I can do to
speed it up, or put in a trap, to stop the stat from failing?
fileTimes = [ ( os.lstat( os.path.join( rootPath, fileName )
)[stat.ST_MTIME], fileName) for fileName in fileList \
if os.path.exists( os.path.join( rootPath, fileName ) ) ]
I'd appreciate any pointers.
John