Python: multiprocessing forking.py assertionError

Categories: Development NotesPython; Tagged with: ; @ March 22nd, 2016 23:32

Issue:  There’s an AssertionError when I try to test  mutliprocessing features using lettuce 0.2.22 / nosetests and python 2.7.10 error details:

multiprocessing\forking.py AssertionError: main
File "", line 1, in 
File "C:\Python27\Lib\multiprocessing\forking.py", line 380, in main
  prepare(preparation_data)
  File "C:\Python27\Lib\multiprocessing\forking.py", line 488, in prepare
    assert main_name not in sys.modules, main_name
AssertionError: __main__

upgrade to python 2.7.11 becuase this is a fixed bug: https://bugs.python.org/issue10128; or
use a wrapper (.py file name should be not in sys.modules, main_name):

# run_at.py:
__requires__ = 'lettuce==0.2.20'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('lettuce==0.2.20', 'console_scripts', 'lettuce')()
    )

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.