[Python-Dev] status of absolute_import w/ python 2.7 (original) (raw)

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Jul 8 15:51:19 CEST 2011


Hi there,

the documentation state that absolute_import feature is the default behaviour with python 2.7, though it seems that it behave differently with the future import :

$ cat package/init.py

import subpackage

$ python2.7 Python 2.7.1+ (default, Apr 20 2011, 22:33:39) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import package

$ cat package/init.py

from future import absolute_import import subpackage

$ python2.7 Python 2.7.1+ (default, Apr 20 2011, 22:33:39) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import package Traceback (most recent call last): File "", line 1, in File "package/init.py", line 23, in import subpackage ImportError: No module named subpackage

Maybe the doc should be fixed ?

Sylvain Thénault LOGILAB, Paris (France) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework: http://www.cubicweb.org



More information about the Python-Dev mailing list