Skip to content

“ConfigParser” has no attribute “readfp” #2112

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

Closed
remdragon opened this issue May 12, 2018 · 0 comments
Closed

“ConfigParser” has no attribute “readfp” #2112

remdragon opened this issue May 12, 2018 · 0 comments
Assignees

Comments

@remdragon
Copy link

I was told this error might be a bug in typeshed:

https://stackoverflow.com/questions/50302677/mypy-error-configparser-has-no-attribute-readfp?noredirect=1#comment87627773_50302677

When I run this command, I get no errors:

mypy --py2 test.py

but when I run this:

mypy test.py

I get this:

test.py:6: error: "ConfigParser" has no attribute "readfp"

Here's test.py, it runs correctly in both py2 and py3:

from io import open
from six.moves import configparser

cfg = configparser.ConfigParser()
with open ( 'test.ini', 'r', encoding='utf-8', errors='strict' ) as f:
    cfg.readfp ( f )
assert cfg.get ( 'foo', 'bar' ) == 'hello'
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

No branches or pull requests

2 participants