A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-July/112286.html below:

[Python-Dev] status of absolute_import w/ python 2.7

[Python-Dev] status of absolute_import w/ python 2.7Sylvain 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 "<stdin>", line 1, in <module>
  File "package/__init__.py", line 23, in <module>
    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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4