Using win32api, how can I determine if a file is opened?
There is an example program WhoUses.exe, but its written in C++.
Using win32api, how can I determine if a file is opened?
There is an example program WhoUses.exe, but its written in C++.
Here's an OS agnostic version:
try:
file = open("thefile.txt", "r+")
except IOError:
print "File is open!"
Edited to add that your question is a duplicate of check if a file is open in Python
If you already have a pointer to the file:
if f.closed:
print('file is closed')