I have one process who's reading from a file (using file.read()
) and one process who's writing to the same file (file.write()
). The problem is it doesn't work - I get no errors but they can't operate at the same time. I've tried making the read and write operations none-blocking and then flushing the stream, as follows:
fcntl.fcntl(file, fcntl.F_SETFL, os.O_NONBLOCK)
file.write(msg)
file.flush()
Am I completely misunderstanding it? How should one accomplish writing and reading to one file from different processes?