[mod_python] python path and 3.3

Graham Dumpleton grahamd at dscpl.com.au
Thu Nov 30 20:12:12 EST 2006

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?

Where is your 'lib' subdirectory relative to the directory you specified the
handler for?

What are you using to import modules from that directory, 'import',
'__import__' or 'apache.import_module()'?

What is the argument you are supplying to these to identify your module?

Does the module argument you are using contain a '/'?

At the moment I can't see how it would have worked before if you never had
PythonPath defined unless you were using '/' in a module name, for example:

  module = apache.import('lib/name')

This should still work with the new importer, but only if done from a publisher
file in the handler root directory, and not one in a subdirectory.

Anyway, can you please post the Apache configuration snippet you are using
to set the directory up for publisher, including any PythonPath directive being
set. Also describe how your directories look and where files live relative to
each other.

Sorry for not just providing a possible solution, but we are going to have to
deal with subtle little differences between new and old importer and for the
first people who run up against them, I want to understand the use cases
properly so I know how to help others later in the best way.

I will explain everything, but if you give me the information I can do a better



More information about the Mod_python mailing list