0

I've googled this quite a bit and can't find a way to tell if a file is currently being accessed or at least written to. Anyone dealt with this before? If one app if writing to a file another can be reading it before the first is finished writing..

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by woooee
0

You could try to test whether the file is open by using f.closed which will return False if the file is open and True if the file is closed, for example:

f = open(somefile, 'r')
f.closed

The above will return False but:

f.close()
f.closed

This will now return True

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.