brunson at brunson.com
Fri Dec 1 10:49:08 EST 2006
Graham Dumpleton wrote: > Eric Brunson wrote .. > >> Eric Brunson wrote: >> >>> I just grabbed the latest SVN snapshot and installed it and I'm having >>> a problem with importing now. >>> >>> Using the publisher handler I'm trying to get my app from 3.1.4 going, >>> but 3.3 no longer seems to want to find my lib/ subdirectory. I've >>> added the following to my .htaccess: >>> >>> PythonPath "['.']+sys.path" >>> >>> I can display the sys.path in an app and it includes ".", but it just >>> doesn't find a subdirectory "lib" >>> >>> Is there something new with the module loading that I should be aware >>> >> of? >> >> Sorry. Got a little quick on the send... Here's the error message: >> >> File "/usr/local/www/data/deviceWebGui/erictest.py", line 3, in <module> >> from lib import HTMLBuilder >> >> ImportError: No module named lib >> >> And lib is a subdirectory of /usr/local/www/data/deviceWebGui/ >> > > The basic reason why this doesn't work for you is that in the old importer, > the directory the Python*Handler directive was specified for was automatically > added to sys.path, but in the new module importer this is no longer done. > > The reason that the directory was added to sys.path in the old importer > was because the standard Python module import mechanism was used > underneath to find modules and without the directory in sys.path, it would > not find them. [ snip ] > > If not, because publisher is used, someone could invoke code in the lib > subdirectory otherwise. > > Anyway, hope I haven't confused you too much. > > Graham > > > Not confusing at all, thanks for taking the time to write such an in depth explanation. We should probably add the entire text of that post to the WiKi. I'll do that later today, with your consent. Sincerly, e.