Configparser import broken on py2.7

Issue #8 resolved
flashbuster
created an issue

According to the docs, the import on python2 should be "import configparser", but that does import the built in version:

>>> import configparser
>>> configparser
<module 'configparser' from '/home/buster/.virtualenvs/cfgparsertest/local/lib/python2.7/site-packages/configparser/__init__.pyc'>
>>> from backports import configparser
>>> configparser
<module 'backports.configparser' from '/home/buster/.virtualenvs/cfgparsertest/local/lib/python2.7/site-packages/backports/configparser/__init__.pyc'>

Comments (9)

  1. Łukasz Langa repo owner

    Are you using python-future by any chance? Unfortunately in 0.14.0 they broke the configparser import by introducing their own. Hopefully, they'll fix it soon. With python-future, you'll get:

    >>> import ConfigParser as CP
    >>> import configparser as cp
    >>> from backports import configparser as bcp
    >>> cp.ConfigParser is bcp.ConfigParser
    False
    >>> CP.ConfigParser is cp.ConfigParser
    True
    

    Without python-future, it is correct:

    >>> import ConfigParser as CP
    >>> import configparser as cp
    >>> from backports import configparser as bcp
    >>> cp.ConfigParser is bcp.ConfigParser
    True
    >>> CP.ConfigParser is cp.ConfigParser
    False
    
  2. Łukasz Langa repo owner

    In 3.5.0b1 I used python-future as a 2/3 compat library, try 3.5.0b2 where I removed that dependency. Uninstall python-future from your virtualenv first.

  3. flashbuster reporter

    The shown commandline is the complete excerpt from the python console and i have never heard of python-future... The virtualenv i used only contains the configparser..

  4. Log in to comment