I have 4 Python scripts / processes running in parallel, each one appending text to a file every ~30 seconds:
while True:
id = processing_job() # 30 seconds long
with open('log.txt', 'a+') as f:
f.write('Job number #%i done.' % id)
Is there a risk, when using open(..., 'a+')
that 2 processes want to write exactly at the same time, and then some text cannot be written in the log.txt
and is lost?
Note: I'm using Windows platform.