Error uploading empty file: "seek() takes 2 positional arguments but 3 were given"
Problem
awscli version "1.11.13-1ubuntu1~16.04.0" was installed with the Ubuntu package manager and run like: [code block] It successfully uploads all the files in the source directory except for one zero-byte file. It fails there with: [code block]
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Upgrade AWS CLI to Fix Zero-byte File Upload Error
The error occurs due to a known issue in the AWS CLI version 1.11.13 where the handling of zero-byte files is not properly managed, leading to an incorrect number of arguments being passed to the 'seek()' function. This bug has been addressed in later versions of the AWS CLI.
Awaiting Verification
Be the first to verify this fix
- 1
Check Current AWS CLI Version
Before proceeding with the upgrade, verify the current version of the AWS CLI to confirm that the issue is present.
bashaws --version - 2
Uninstall Current AWS CLI Version
Remove the existing version of AWS CLI installed via the package manager to avoid conflicts with the new installation.
bashsudo apt-get remove awscli - 3
Install Latest AWS CLI Version
Download and install the latest version of AWS CLI using the official installation method to ensure all bugs are fixed.
bashcurl "https://awscli.amazonaws.com/AWSCLIV2.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install - 4
Verify AWS CLI Installation
After installation, confirm that the AWS CLI is correctly installed and check the version to ensure it is updated.
bashaws --version - 5
Test Upload of Zero-byte File
Attempt to upload the previously failing zero-byte file to verify that the issue has been resolved with the new version.
bashaws s3 cp path/to/zero-byte-file s3://your-bucket-name/
Validation
If the upload of the zero-byte file completes successfully without any errors, the fix has worked. Additionally, ensure that other files can still be uploaded without issues.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep