Hi everyone,
I currently have a problem with reading one of my files.
Normally I'd read files like so:
overf = 'C:\\overf'
my_overf = open(overf,'r')
contents = my_overf.readlines()
my_overf.close()

now the file Im trying to read has recently had alot of read/writes from 
other users/threads/etc, so every now and again I get a
IOError: [Errno 9] Bad file descriptor
I know this has something to do with not being able to read while some 
filehandles are open (or is it?)..I've tried using the following snippet

try:       
     while my_overf.readline() != '':
      contents.append(my_overf.readline())
except Exception:
     d = 0 #do nothing

but it works far slower than normal readlines()...is there a way to 
check the status of this file and wait until the error has gone (i.e 
wait until other users/programs are done with it)?
Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to