is file open?

Giraud, Sebastien sebastien.giraud at eds.com
Thu Dec 18 04:09:48 EST 2003


I should work cause it's made for it :)
I had same problem checking socket bind and try did help me well :)

-----Message d'origine-----
De : python-list-bounces+sebastien.giraud=eds.com at python.org
[mailto:python-list-bounces+sebastien.giraud=eds.com at python.org] De la part
de Maxim Khesin
Envoyé : mercredi 17 décembre 2003 23:41
À : python-list at python.org
Objet : is file open?


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
	
-- 
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list