New submission from Dirkjan Ochtman:

This seems confusing:

djc@enrai test $ ls -lR
.:
total 0
drwxr-xr-x 4 djc users 160 Nov 28 15:35 pkg

./pkg:
total 4
-rw-r--r-- 1 djc users  39 Nov 28 15:37 http.py
-rw-r--r-- 1 djc users   0 Nov 28 15:34 __init__.py
drwxr-xr-x 3 djc users 136 Nov 28 15:40 tests

./pkg/tests:
total 8
-rw-r--r-- 1 djc users  21 Nov 28 15:37 http.py
-rw-r--r-- 1 djc users  27 Nov 28 15:40 __init__.py

djc@enrai test $ cat pkg/__init__.py
djc@enrai test $ cat pkg/http.py
from http.client import HTTPConnection
djc@enrai test $ cat pkg/tests/__init__.py
from pkg.tests import http
djc@enrai test $ cat pkg/tests/http.py
from pkg import http
djc@enrai test $ python3
Python 3.2.3 (default, May 28 2012, 09:27:08)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg import http
>>>
djc@enrai test $ python3
Python 3.2.3 (default, May 28 2012, 09:27:08)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg.tests import http
>>>
djc@enrai test $ PYTHONPATH=. python3 pkg/tests/__init__.py
Traceback (most recent call last):
  File "pkg/tests/__init__.py", line 1, in <module>
    from pkg.tests import http
  File "/home/djc/src/test/pkg/tests/__init__.py", line 1, in <module>
    from pkg.tests import http
  File "/home/djc/src/test/pkg/tests/http.py", line 1, in <module>
    from pkg import http
  File "/home/djc/src/test/pkg/http.py", line 1, in <module>
    from http.client import HTTPConnection
  File "/home/djc/src/test/pkg/tests/http.py", line 1, in <module>
    from pkg import http
ImportError: cannot import name http

----------
components: Interpreter Core
messages: 176545
nosy: brett.cannon, djc, ncoghlan
priority: normal
severity: normal
status: open
title: Absolute imports fail to take full path into account?
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16570>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to