multiprocessing-logging
multiprocessing-logging copied to clipboard
Not working in macOSX
cannot pass the test on macOSX 11.2.2
reporting: AttributeError: Can't pickle local object 'WhenMultipleProcessesLogRecords.test_then_records_should_not_be_garbled.
I have no idea what's that error. Only Linux is supported.
Personally, I was able to get this working on OSX by changing the default multiprocessing behavior from spawn (OSX default as of Python 3.8 I think) to fork (Linux default). You can read more about it here.
The magic snippet is to make the first line of your program:
multiprocessing.set_start_method('fork') # Update default for OSX.
Do note that the linked python docs state:
Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725
So, change the method at your own risk.
This approach seems problematic. Why not use the QueueHandler and corresponding listener directly?
The OS is not supported. The approach of this module only work with "fork".