Tuesday, 19 January 2021

Reading a file without locking it in python

I want to read a file, but without any lock on it.

with open(source, "rb") as infile:
            data = infile.read()

Is the code above can lock the source file ?

This source file can be updated at any time with new rows (during my script running for example). I think not because it is only in reading mode ("rb"). But I found that we can use Windows API to read it without lock. I did not find an simple answer for my question.

My script runs locally but the source file and the script/software wich appends changes on it are not (network drive).



from Reading a file without locking it in python

No comments:

Post a Comment