【发布时间】:2019-10-03 02:21:16
【问题描述】:
我在这里很新。我会尽量说清楚。
我用 pytables 创建了一个 hdf5 文件,并用数据填充了它。 然后,我使用以下代码将文件从我的 aws 集群的 /tmp/ 目录上传到 S3 存储桶:
-
s3_client.upload_file(local_file_key, aws_bucket_name, aws_file_key)
我已经从 S3 下载了相同的 hdf5 文件,并使用以下代码将其再次存储在我的 aws 集群的 /tmp/ 目录中:
s3_client.download_file(aws_bucket_name, aws_file_key, another_local_file_key)
直到那里,没有问题。当我想读取上传的文件时出现问题。
tables.open_file(another_local_file_key)
File "H5F.c", line 604, in H5Fopen
unable to open file
File "H5Fint.c", line 1087, in H5F_open
unable to read superblock
File "H5Fsuper.c", line 277, in H5F_super_read
file signature not found
End of HDF5 error back trace
Unable to open/create file '/tmp/from_aws_dataset.hdf5'
然后,我在集群的shell中做了一些验证。
[user@cluster_ip_address tmp$] file my_dataset.hdf5
返回
my_dataset.hdf5: Hierarchical Data Format (version 5) data
但是[user@cluster_ip_address tmp$] file from_aws_dataset.hdf5返回
from_aws_dataset.hdf5: data
在我的python代码中,
tables.is_pytables_file('/tmp/from_aws_dataset.hdf5') 返回None
boto3 version: '1.4.7', python version: 2.7, tables version: '3.4.2', h5py version: '2.7.1'
有人可以帮帮我吗?
【问题讨论】:
-
我遇到了类似的问题,但我使用的是
h5py。就我而言,我的错误是我在写入数据后忘记关闭文件。
标签: python amazon-s3 hdf5 boto3 pytables