Kyle Smith <kyle.sm...@meraki.net> added the comment:
Interesting. I did try between MacOS (12.2) and Ubuntu since I have servers with older python versions. For scoping then, this appears to be related only to MacOS since you were able to confirm it working correctly on Linux. The code is the same, but here's the entire traceback. All below examples were run on MacOS: bash-3.2$ python3 --version Python 3.9.6 bash-3.2$ python3 main.py Traceback (most recent call last): File "/Volumes/Workspace/co/router/main.py", line 21, in <module> shared_dict, shared_lock = get_shared_state(HOST, PORT, KEY) File "/Volumes/Workspace/co/router/main.py", line 12, in get_shared_state manager.start() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py", line 553, in start self._process.start() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start self._popen = self._Popen(self) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__ super().__init__(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__ self._launch(process_obj) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch reduction.dump(process_obj, fp) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'get_shared_state.<locals>.<lambda>' Running this with 3.7.9 works: bash-3.2$ python3.7 --version Python 3.7.9 bash-3.2$ python3.7 main.py {'number': 0, 'text': 'Hello World'} If it's of interest, 3.10.2 is also failing on Mac. bash-3.2$ /usr/local/opt/python\@3.10/bin/python3 --version Python 3.10.2 bash-3.2$ /usr/local/opt/python\@3.10/bin/python3 main.py Traceback (most recent call last): File "/Volumes/Workspace/co/router/main.py", line 21, in <module> shared_dict, shared_lock = get_shared_state(HOST, PORT, KEY) File "/Volumes/Workspace/co/router/main.py", line 12, in get_shared_state manager.start() File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/managers.py", line 562, in start self._process.start() File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 121, in start self._popen = self._Popen(self) File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 32, in __init__ super().__init__(process_obj) File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_fork.py", line 19, in __init__ self._launch(process_obj) File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 47, in _launch reduction.dump(process_obj, fp) File "/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'get_shared_state.<locals>.<lambda>' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46871> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com