Phillip J. Eby wrote:
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?
Hmm... I think I got it wrong, this works fine. Maybe I was confusing this with a bug related to packages with spaces in their names. In particular, WSGIUtils: http://www.owlfish.com/software/wsgiutils/downloads/WSGI%20Utils-0.5.tar.gz I suspect this doesn't work because it creates an egg WSGI_Utils-0.5-py2.4.egg/, with a package name (in WSGI_Utils-0.5-py2.4.egg/EGG-INFO/PKG-INFO) of "WSGI Utils" -- Ian Bicking / ianb@colorstudy.com / http://blog.ianbicking.org