【发布时间】:2018-08-09 05:09:42
【问题描述】:
我正在尝试从 AWS S3 读取 h5 文件。使用 s3fs/boto3 时出现以下错误。你能帮我吗?谢谢!
import s3fs
fs = s3fs.S3FileSystem(anon=False, key='key', secret='secret')
with fs.open('file', mode='rb') as f:
h5 = pd.read_hdf(f)
TypeError:预期的 str、字节或 os.PathLike 对象,而不是 S3File
fs = s3fs.S3FileSystem(anon=False, key='key', secret='secret')
with fs.open('file', mode='rb') as f:
hf = h5py.File(f)
TypeError:预期的 str、字节或 os.PathLike 对象,而不是 S3File
client = boto3.client('s3',aws_access_key_id='key',aws_secret_access_key='secret')
result = client.get_object(Bucket='bucket', Key='file')
with h5py.File(result['Body'], 'r') as f:
data = f
TypeError:预期的 str、bytes 或 os.PathLike 对象,而不是 StreamingBody
【问题讨论】:
标签: python amazon-s3 boto3 h5py