gpt4 book ai didi

amazon-s3-select - botocore.异常.ClientError : An error occurred (InvalidTextEncoding) when calling the SelectObjectContent operation

转载 作者:太空宇宙 更新时间:2023-11-03 21:28:52 28 4
gpt4 key购买 nike

通过 python 执行以下代码时

response= S3.select_object_content(Bucket=S3_bucket_name,Key=S3_file_Key,ExpressionType='SQL', Expression="select count(*) from s3object", InputSerialization={'CSV': {"FileHeaderInfo": header_usage},'CompressionType':compressformat}, OutputSerialization={'CSV': {}},)

我收到类似错误

回溯(最近一次调用最后一次):

  File OutputSerialization={'CSV': {}},)
File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 320, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 623, in _make_api_call
raise error_class(parsed_response, operation_name)

**ClientError: An error occurred (InvalidTextEncoding) when calling the SelectObjectContent operation: UTF-8 encoding is required. The text encoding error was found near byte 49,152.**

我在 boto3 中搜索无效文本编码但找不到。你能帮我检查一下吗?

提前致谢

最佳答案

您希望收到的数据的输出序列化有误。输出序列化 描述您希望 Amazon S3 作为响应返回的数据格式,并且您要求它返回编码错误的格式。我无法自己测试您的代码,因为我只有一小部分代码,但您需要将序列化输出编码为 utf-8 格式,否则 Amazon S3 存储服务无法序列化您的响应。您可能需要扩展 OutputSerialization={'CSV': {}} 以确保您的响应以 UTF-8 格式编码。

也许这些资源可以帮助您:

Select object content parameter guide

select Object Content description

关于amazon-s3-select - botocore.异常.ClientError : An error occurred (InvalidTextEncoding) when calling the SelectObjectContent operation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53665781/

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