Python Boto3 S3存储桶加密结果为0字节文件 [英] Python Boto3 S3 Bucket Encryption result in 0 bytes file
问题描述
这里需要一些帮助.
我有一个使用Boto3的Python脚本,该脚本执行S3存储桶加密.在此之前,它运行良好,最近我注意到当我使用脚本时,它将导致对象变为0字节. 如果我要通过控制台手动对其进行加密,那么它就可以正常工作.
I have a Python script using Boto3 that does S3 Bucket encryption. It was working fine before this and just recently I noticed that when I use the script, it will cause the object to become 0 bytes. It is working just fine if I were to encrypt it manually via the console.
有人遇到类似的问题,您愿意分享任何解决方法吗?至少要恢复回来的文件.我在这里一无所知.
Is anyone facing similar issue and would you mind to share any workaround? At least to recover back the files. I am clueless here.
我进行了快速故障排除,发现执行以下行时,它将文件更改为0字节.
I've did a quick troubleshooting and found out that when below line is executed, it will change the files to become 0 bytes.
client.put_object(Bucket=bucket_name, Key=object_key, ServerSideEncryption='AES256')
非常感谢您的帮助和帮助.
Thank you very much for your help and assistance.
关于, 阿米尔(Ameer).
Regards, Ameer.
推荐答案
该行代码缺少Body
参数.您没有告诉它要上传什么文件或内容.
That line of code is missing a Body
parameter. You aren't telling it what file or contents to upload.
这篇关于Python Boto3 S3存储桶加密结果为0字节文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!