I would like several processes running in parallel to read and write to the same numpy array. To avoid problems, where two processes try to read/write to the same memory, I need to protect the file I am writing to. How do I do that?
I assume that np.savetxt
does not protect the file. I have tried the library portalocker
. But by opening a file and locking it, np.savetxt
is not allowed to write to the file.