Nick Coghlan <ncogh...@gmail.com> added the comment:

Right, this is a separate bug in pkgutil. Specifically, when it goes to import 
a package in order to check it for submodules, it invokes the global import 
system via __import__() rather than constraining the import to the path 
argument supplied to walk_packages.

This means that it will only find it if the path being walked is already on 
sys.path. In the case of your example, it isn't (it's on a subdirectory).

The reason my new tests didn't pick this up is that they're built on the 
test_runpy infrastructure, and one of the steps in that infrastructure is to 
add the new package path to sys.path so it can be imported.

This isn't an easy one to fix - you basically need something along the lines of 
a PEP 406 style import engine API in order to do the import without having 
potentially adverse effects on the state in the sys module.

----------

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

Reply via email to