gpt4 book ai didi

python - 使用 h5py 在 debian python 中访问文件

转载 作者:太空宇宙 更新时间:2023-11-04 04:01:27 29 4
gpt4 key购买 nike

我们在 debian 中使用 python h5py 时遇到问题。数据文件与脚本文件位于同一目录中。我尝试使用 chmod -r 和 chmod 777 为文件 test.h5 提供正确的权限。错误在普通用户中显示,就像 root 访问一样。

当我们运行这个脚本时:

## Libarys importeren
import wradlib

#inlezen hdf5 file en config
raw = wradlib.io.read_OPERA_hdf5("test.h5")

我们收到此错误:

root@wxserv:/home/kbroeren# python light.py
Traceback (most recent call last):
File "light.py", line 5, in <module>
raw = wradlib.io.read_OPERA_hdf5("test.h5")
File "/usr/local/lib/python2.7/dist-packages/wradlib-0.1.1-py2.7.egg/wradlib/io.py", line 652, in read_OPERA_hdf5
f = h5py.File(fname, "r")
File "/usr/lib/python2.7/dist-packages/h5py/_hl/files.py", line 150, in __init__
fid = make_fid(name, mode, fapl)
File "/usr/lib/python2.7/dist-packages/h5py/_hl/files.py", line 45, in make_fid
fid = h5f.open(name, h5f.ACC_RDONLY, fapl=plist)
File "h5f.pyx", line 70, in h5py.h5f.open (h5py/h5f.c:1618)
IOError: unable to open file (File accessability: Unable to open file)
root@wxserv:/home/kbroeren#

有人可以帮助我们解决这个问题吗?

谢谢!

最佳答案

该错误似乎是因为您在本地目录中没有名为 test.h5 的文件,或者您实际上没有打开它的权限。如果是前者,请创建一个名为 test.h5 的文件供您使用。但根据错误,听起来它可能存在,但具有类似 --------- 的权限。如果是这样,您可以尝试运行 chmod u+r test.h5 并重新运行您的程序。

关于python - 使用 h5py 在 debian python 中访问文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22794522/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com