1 回答
- 最新
- 投票最多
- 评论最多
0
I was having the same problem with code adapted from https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-uploading-files.html
s3_client.upload_file completed without an exception but the file was not visible in the S3 web console or via "aws s3 ls s3://bucket-name"
The issue was with these lines:
if object_name is None:
object_name = file_name
file_name is actually a file path and the upload seems to silently fail if it contains path separators. The workaround is either to always provide an object_name or change it to:
if object_name is None:
object_name = file_name.split(os.path.sep)[-1:][0]
已回答 4 年前