[mod_python] PythonImport: Can someone please draw a diagram for this idiot?

Tony Burger tony at dorintony.com
Wed Sep 14 18:35:09 EDT 2005

You could initialize a pool of connections via this tool:


Its fairly easy to compile and setup and has decent documentation for 
Python.  Not sure if this is what your trying to get at.

jamestmcneill-python at yahoo.co.uk wrote:
> Lee,
> Sorry for being crabbit, you didn't deserve it. Anyway I'm still on track
> of this PythonImport thing, and a couple of simple test rule out come
> possibilities.
> 1) I've run the main handler to show req.interpreter, and it is
> 'myinterpreter' as specified.
> 2) I've gone into IDLE and done what I'm trying to do in the main handler,
> namely:
> import mpglobals
> cur = mpglobals.con.cursor()
> That works correctly, and produces a compiled mpglobls.pyc in the same
> folder. Also I stuck some logger code into mpglobals, and that wrote to a
> text file as expected.
> 3) From this I can see that the PythonImport directive doesn't seem to be
> working at all (or at least, in any way I expected it to). It does not
> produce a compiled version of the module specified, nor does it run the
> logger code. However it works, it does not run as if I had an "import
> mpglobals" command in the main handler. In fact I've tried that, and it
> runs properly, showing that mpglobals is on sys.path within the main
> request handler, and that the code within it works properly.
> Really, as far as I can see (not far admittedly) either we're into some
> pretty weird territory with PythonImport and I'm just not getting all this
> C API and subinterpreter doodah, or it simply doesn't work under my
> configuration (Windows XP and Python 2.3).
> Can anyone suggest a simple test to show whether or not PythonImport is
> working at all on my system? Or have I already shown that it hasn't, with
> what I've done already?
> Cheers
> Jim
> --- Lee Brown wrote:
>>It was not my intention to be condescending; rather, I was attempting to
>>in good humor and I apologize for the offense.  In fact, I had the exact
>>same problem with imports and namespaces only a few months ago.
>>If your object is still not accessible in the correct namespace, then
>>next thing to check is to see if your code is executing under the
>>interpreter name that you think it should.    The example code that
>>Bump published will help you determine this.
>>I agree with you that doing an import once at server startup rather than
>>each request seems like a cleaner way to go.  The only drawback is that
>>you change the code in the imported module you'll have to re-start the
>>server but this usually isn't a problem for many applications.
>>Best Regards,
>>Lee E. Brown
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> +   If you've got a good excuse - don't use it   +
> ++++++++++++++++++++++++++++++++++++++++++++++++++)
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list