RE : is file open?

G

Giraud, Sebastien

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 : [email protected]
[mailto:p[email protected]] De la part
de Maxim Khesin
Envoyé : mercredi 17 décembre 2003 23:41
À : (e-mail address removed)
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top