Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: AttributeError: ConfigParser instance has no attribute 'read_string' #989

Closed
mtmiller opened this issue Jul 26, 2018 · 1 comment

Comments

@mtmiller
Copy link

Since version 2.0.2, s3cmd with Python 2.7 fails with this error, when using what comments in the code now refer to as the "deprecated credentials file format".

Invoked as: /tmp/s3cmd/bin/s3cmd ls s3://bucket/
Problem: AttributeError: ConfigParser instance has no attribute 'read_string'
S3cmd:   2.0.2
python:   2.7.15 (default, May  1 2018, 05:55:50) 
[GCC 7.3.0]
environment LANG=en_US.UTF-8

Traceback (most recent call last):
  File "/tmp/s3cmd/bin/s3cmd", line 3092, in <module>
    rc = main()
  File "/tmp/s3cmd/bin/s3cmd", line 2792, in main
    cfg = Config(options.config, options.access_key, options.secret_key, options.access_token)
  File "/tmp/s3cmd/local/lib/python2.7/site-packages/S3/Config.py", line 221, in __init__
    self.aws_credential_file()
  File "/tmp/s3cmd/local/lib/python2.7/site-packages/S3/Config.py", line 303, in aws_credential_file
    config.read_string(config_string.decode('utf-8'))
AttributeError: ConfigParser instance has no attribute 'read_string'

The contents of the credentials file are just the following two lines

aws_access_key_id=xxxx
aws_secret_access_key=yyyy

Any one of the following workarounds fixes this bug:

  1. Add a [default] header to the credentials file.
  2. pip install configparser to install the Python 3 compatible version of configparser.
  3. Downgrade to s3cmd 2.0.1, where this all worked previously.

This regression was introduced with the changes in PR #966.

@fviard
Copy link
Contributor

fviard commented Mar 29, 2020

Fixed, thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants