[Distutils] pkg_resources: failed require

Phillip J. Eby pje at telecommunity.com
Mon May 30 18:45:10 CEST 2005

At 02:54 AM 5/30/2005 -0500, Ian Bicking wrote:
>I notice when I install into app-packages/, then do:
>  >>> from pkg_resources import *
>  >>> require('SomePackage')
>... fails ...
>  >>> import sys
>  >>> sys.path.append('app-packages')
>  >>> require('SomePackage')
>... still fails ...
>But if I fix sys.path immediately, then it does work, so the failure
>seems to be sticky.

That's very odd; require() doesn't do any caching.  Even the PEP 
302-defined caching (sys.path_importer_cache) is from *particular* path 
entries (e.g. app-packages) to importer objects created for them.  So if 
app-packages wasn't on sys.path, it never would've had anything cached.

Are you able to reliably reproduce the double-failure condition?  Is the 
error message the same each time?

More information about the Distutils-SIG mailing list