AttributeError: Can't pickle local object 'PyxxlRunner.run_with_daemon.._runner'
搭配 FastAPI 一起使用时,按照文档上的方法操作,发现爆这个错误
python 3.9.15
试了一下 example 也同样有这个问题
self.cfg.when_ready(self)
File "gunicorn.conf.py", line 30, in when_ready
runner.run_with_daemon()
File "/Users/xxx/xxx/xxx/pyxxl/example/gunicorn_app/env/lib/python3.9/site-packages/pyxxl/main.py", line 110, in run_with_daemon
daemon.start()
File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/opt/homebrew/Cellar/python@3.9/3.9.15/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 'PyxxlRunner.run_with_daemon.<locals>._runner'
AttributeError: Can't pickle local object 'PyxxlRunner.run_with_daemon.._runner'
搭配 FastAPI 一起使用时,按照文档上的方法操作,发现爆这个错误
python 3.9.15
试了一下 example 也同样有这个问题