is file open?

Maxim Khesin max at cNvOiSsiPoAnMtech.com
Wed Dec 17 17:40:52 EST 2003


I have a script that processes a file generated by another program. I 
need an unumbiguous way to know that the file has been written and 
closed by the other program, at least on Windoze. I am thinking of doing

def CanOpen(fname):
	try:
		f = open(fname, 'a')
		f.close()
		return True
	except IOError:
		return False

should this work OK?

thanks,
max
	




More information about the Python-list mailing list