Message165605
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. |
|
Date |
User |
Action |
Args |
2012-07-16 13:53:44 | ncoghlan | set | recipients:
+ ncoghlan, brett.cannon, eric.smith, eric.araujo, Arfrever, chris.jerdonek, gennad |
2012-07-16 13:53:44 | ncoghlan | set | messageid: <1342446824.19.0.825979597694.issue14787@psf.upfronthosting.co.za> |
2012-07-16 13:53:43 | ncoghlan | link | issue14787 messages |
2012-07-16 13:53:43 | ncoghlan | create | |
|