Check if a file is closed

C

camillo

How to check if a file is closed?

On Win32 you can call CreateFile with write and share write and if it
raises an error, the file is closed.

How to do it in Python???

Thanks,
Camillo
 
S

Sybren Stuvel

(e-mail address removed) enlightened us with:
How to check if a file is closed?

On Win32 you can call CreateFile with write and share write and if it
raises an error, the file is closed.

On Linux you can read /proc to see which process has which file
opened, and if it isn't in there, it's closed.

Sybren
 
B

bruno at modulix

How to check if a file is closed?
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__iter__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__str__', 'close', 'closed', 'encoding',
'fileno', 'flush', 'isatty', 'mode', 'name', 'newlines', 'next', 'read',
'readinto', 'readline', 'readlines', 'seek', 'softspace', 'tell',
'truncate', 'write', 'writelines', 'xreadlines']True
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top