Klortho / settings-resolver

Allows interdependent Django settings overrides, through late binding
Do What The F*ck You Want To Public License
1 stars 0 forks source link

Python 2 incompatibility #1

Open rrei opened 8 years ago

rrei commented 8 years ago

Hi, first of all thanks for the library, it's simple to use and solves an important problem in a very general way :)

Just wondering if you'd consider using something like six or future to provide Py2 compatibility. I took a glance at the source and your main.py is fully Py2 compatible already. The problem I'm getting actually comes from merged_tree.py, which imports abc from the collections, and that is not its correct location in python 2.

> ipython
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from collections import abc
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-82a6809cfe39> in <module>()
----> 1 from collections import abc

ImportError: cannot import name abc

I believe that this is the only problem, so even the simple code below, placed at the top of merged_tree.py, should suffice:

try:
    from collections import abc  # Py3
except ImportError:
    import abc  # Py2
Klortho commented 8 years ago

I don't have any problem fixing it so it's compatible with P2, but I don't use it, myself, and I don't have a lot of time these days. Could you try this out yourself and send it as a PR?

rrei commented 8 years ago

Alright, here you go! #2

rrei commented 8 years ago

Ping?