Python “multiprocessing” “Can’t pickle…”

<p>Python gets &lsquo;&hellip;Can&rsquo;t pickle&hellip;&rsquo; when using &lsquo;multiprocessing&rsquo;.<br /> It&lsquo;s more than &lsquo;pickle&rsquo; issue but OS related issue.</p> <h2>Background</h2> <ul> <li>In previous&nbsp;<a href="https://medium.com/devopss-hole/python-lxml-memory-leak-b8d0b1000dc7" rel="noopener">article</a>, I bumped into the &lsquo;lxml&rsquo; issue and the solution is to execute the function using &lsquo;lxml&rsquo; in a separate process</li> <li>Implement a decorator to wrap a function to run in a separate process</li> <li>The &lsquo;run_on_subprocess&rsquo; decorator uses &lsquo;multiprocessing&rsquo; Python package</li> <li>Use Macbook for the Python service development</li> <li>The service is hosted on a Python Docker service in formal environment</li> </ul> <p><a href="https://medium.com/devopss-hole/python-multiprocessing-pickle-issue-e2d35ccf96a9"><strong>Website</strong></a></p>