Environment:
uname -a
to check OS:Linux NAME 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64 GNU/Linux
- Python version:
Python 3.4.1 |Anaconda 2.1.0 (64-bit)| (default, Sep 10 2014, 17:10:18)
(a 3rd party module requires py3.4)
Behaviour:
- When trying to write logs in each process, e.g. one log file for each process, files can be created but no content is written.
Debug:
- No expected errors in worker function
- Failed to write even in single-processing or just call the function without
multiprocessing
module
Solution:
- add
file_handle.flush()
after eachfile_handle.write('some content')
. See https://stackoverflow.com/a/28326928/6769366 for details.