[issue16570] Absolute imports fail to take full path into account?

Brett Cannon report at bugs.python.org
Wed Nov 28 18:21:46 CET 2012


Brett Cannon added the comment:

This test example is nonsensical. You are directly executing a package which leads to pkg/tests being put in sys.path first. That means you end up with http in pkg/tests masking the one in the stdlib, which causes your ``from http.clients import HTTPConnection`` to fail. You should be using the -m option with a proper __main__.py file to avoid this. If you do that with a __main__.py file doing nothing more than ``from pkg import tests`` everything works.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16570>
_______________________________________


More information about the Python-bugs-list mailing list