Cloudpickle 的 load() 方法导致 Linux 系统上的 FileNotFoundError

Cloudpickle's load() Method Results in FileNotFoundError on Linux Systems

提问人:Tom Lever 提问时间:11/17/2023 最后编辑:Amit MohantyTom Lever 更新时间:11/20/2023 访问量:16

问:

我在 Linux 系统(CentOS 和 Ubuntu)上运行 Python 脚本时遇到了一个问题,使用类似于以下内容的代码:

import os
import cloudpickle

filename = 'name.ext'
assert(os.path.isfile(filename))
with open(filename, 'rb') as file:
    deserialized_object = cloudpickle.load(file)

但是,我一直收到以下错误:

Traceback (most recent call last):
  File "/home/tslever/Bayesian_Docking-Score_Predictor/Load_PyMC_Model_And_Training_Inference_Data_And_Create_Visualizations.py", line 155, in <module>
    main(
  File "/home/tslever/Bayesian_Docking-Score_Predictor/Load_PyMC_Model_And_Training_Inference_Data_And_Create_Visualizations.py", line 73, in main
    pymc_model = cloudpickle.load(file)
  File "/usr/lib/python3.10/multiprocessing/managers.py", line 942, in RebuildProxy
    return func(token, serializer, incref=incref, **kwds)
  File "/usr/lib/python3.10/multiprocessing/managers.py", line 792, in __init__
    self._incref()
  File "/usr/lib/python3.10/multiprocessing/managers.py", line 846, in _incref
    conn = self._Client(self._token.address, authkey=self._authkey)
  File "/usr/lib/python3.10/multiprocessing/connection.py", line 502, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.10/multiprocessing/connection.py", line 630, in SocketClient
    s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory

我已通过使用 确保文件存在,但该方法遇到了 FileNotFoundError。我不确定此问题的原因以及如何解决它。name.extos.path.isfile()cloudpickle.load()

任何人都可以提供有关如何解决此问题的见解或建议吗?任何帮助将不胜感激。

python-3.x Linux Cloudpickle

评论


答: 暂无答案