os.path.join 在 Enthought/Python 中返回 Errno22
我正在使用一个相当复杂的 Enthought/Python 程序,该程序返回此错误:
File "C:\Users\riddle\Desktop\FCI2\src\equation.py", line 41, in main
fci_data = np.load(os.path.join(local_data_path, "fci_data.npy"))
File "C:\Python27\lib\site-packages\numpy\lib\npyio.py", line 329, in load
fid = open(file, "rb")
IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\\Users\white\\Desktop\
\FCI2New\\data\\fci_data.npy'
关于这一点:
fci_data = np.load(os.path.join(local_data_path, "fci_data.npy"))
fci_data = fci_data.replace("'\\','/'")
额外的斜杠特别让我困惑。 local_data_path 是全局的,定义如下:
local_data_path = static.base_data_path
base_data_path = "C:\Documents and Settings\white\Desktop\FCI2New\data" (from the static module)
有人知道这里可能是什么问题吗? “rb”应该是 fci_data 的正确模式。请原谅任何错误或明显的问题,我是初学者。
安妮
I'm working with a fairly complex Enthought/Python program that is returning this error:
File "C:\Users\riddle\Desktop\FCI2\src\equation.py", line 41, in main
fci_data = np.load(os.path.join(local_data_path, "fci_data.npy"))
File "C:\Python27\lib\site-packages\numpy\lib\npyio.py", line 329, in load
fid = open(file, "rb")
IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\\Users\white\\Desktop\
\FCI2New\\data\\fci_data.npy'
With respect to this:
fci_data = np.load(os.path.join(local_data_path, "fci_data.npy"))
fci_data = fci_data.replace("'\\','/'")
The additional slashes are particularly puzzling me. local_data_path is global and is defined like so:
local_data_path = static.base_data_path
base_data_path = "C:\Documents and Settings\white\Desktop\FCI2New\data" (from the static module)
Anyone have an idea what might be the issue here? 'rb' should be the correct mode for fci_data. Please forgive any errors or obvious questions, I'm a beginner.
Anne
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先尝试标准化路径:
try first to normalize the path :