molotov
molotov copied to clipboard
"TypeError: cannot pickle '_io.TextIOWrapper' object" when setting processes argument
I'm getting the following TypeError when trying to set the -p
/--processes
argument, per the docs:
https://molotov.readthedocs.io/en/stable/tutorial/?highlight=processes#running-one-scenario
molotov -w 10 -p 4 -d 2 -x loadtest.py
**** Molotov v2.1. Happy breaking! ****
Traceback (most recent call last):
File "/Volumes/Dev/github/pdehaan/molotov-tests/venv/bin/molotov", line 11, in <module>
load_entry_point('molotov==2.1', 'console_scripts', 'molotov')()
File "/Volumes/Dev/github/pdehaan/molotov-tests/venv/lib/python3.8/site-packages/molotov/run.py", line 223, in main
return run(args)
File "/Volumes/Dev/github/pdehaan/molotov-tests/venv/lib/python3.8/site-packages/molotov/run.py", line 301, in run
res = Runner(args)()
File "/Volumes/Dev/github/pdehaan/molotov-tests/venv/lib/python3.8/site-packages/molotov/runner.py", line 73, in __call__
return self._launch_processes()
File "/Volumes/Dev/github/pdehaan/molotov-tests/venv/lib/python3.8/site-packages/molotov/runner.py", line 96, in _launch_processes
p.start()
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_io.TextIOWrapper' object
on macOS using Python 3.8.5 and Molotov v2.1 (latest, per https://pypi.org/project/molotov/).
This seems to have been fixed in the unreleased 2.2 on GitHub, per
python -m pip install https://github.com/loads/molotov/archive/refs/tags/2.2.tar.gz