Skip to content

Fix Python 3 bytes string encoding when getting IAM credentials#947

Merged
fviard merged 1 commit intos3tools:masterfrom
alexallah:master
Mar 3, 2018
Merged

Fix Python 3 bytes string encoding when getting IAM credentials#947
fviard merged 1 commit intos3tools:masterfrom
alexallah:master

Conversation

@alexallah
Copy link
Copy Markdown
Contributor

The files variable has a type of bytes() in Python 3.

For example, if files = b'master' then the request path would be formatted as
"/latest/meta-data/iam/security-credentials/b'master'"

The .decode() method converts a bytes into a proper string in Python 3 and doesn't change anything in Python 2.

@alexallah
Copy link
Copy Markdown
Contributor Author

Without the fix, I was getting this error message:

ERROR: /root/.s3cfg: None
ERROR: Configuration file not available.
ERROR: Consider using --configure parameter to create one.

@fviard fviard merged commit a018bb0 into s3tools:master Mar 3, 2018
@fviard
Copy link
Copy Markdown
Contributor

fviard commented Mar 3, 2018

Merged, thank you!

fviard added a commit to fviard/s3cmd that referenced this pull request Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants