HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.79k stars 192 forks source link

Fix : Deprecated usage of ConfigParser.readfp #93

Closed MaximeWeyl closed 3 years ago

MaximeWeyl commented 4 years ago

All 46 tests passing for python 3.7. Tests not run with python 2.7 because it is obsolete.

Fixes #92

MaximeWeyl commented 4 years ago

The fail is on python 2.7, which is obsolete.

henriquebastos commented 3 years ago

This PR breaks the support for Python 2. Can you come up with a solution?

KyleKing commented 3 years ago

If this helps, this is how tox handles Python 2 and readfp (tests/unit/session/test_show_config.py#L12)

Which might look something like this:

from six import PY2

with open(source, encoding=encoding) as file_:
    config_reader = parser.readfp if PY2 else parser.read_file
    config_reader(file_)
henriquebastos commented 3 years ago

Nice @KyleKing. @MaximeWeyl Python 2 is still a reality and decouple will be supporting it for now. If you can update your PR I would gladly merge it.

pietrodn commented 3 years ago

I implemented a variant of this patch that supports Python 2 in here.

henriquebastos commented 3 years ago

Closing in favor of #121 Thank you all.