1 Answer
- Newest
- Most votes
- Most comments
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]
answered 4 years ago
Relevant content
- Accepted Answerasked a year ago
- asked 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago