[mod_python] Re: Your article: mod_python module importing is broken

Graham Dumpleton grahamd at dscpl.com.au
Wed Sep 14 23:11:59 EDT 2005


What you are seeing is normal, especially if you are using the "prefork"
mode of Apache. What you will probably find is that each line of output
was from a different Apache child subprocess. The order in which
sys.path is constructed will be dependent upon the order in which
separately configured request handlers are visited by incoming requests.

Thus sys.path order is to a degree random as far as directories
corresponding to handlers. This is actually a bad thing and source
of various problems. Changes speculated on for mod_python 3.3/4.0
may improve this situation hopefully.

It is recommended you ask questions about mod_python on the mod_python
mailing list and not me direct. So please get on the mailing list if
you can and post any followups or further questions there.

Graham


On 13/09/2005, at 7:42 PM, Michal J. Gajda wrote:

> Dear Graham,
>
> I've just stumbled upon your article in which you explain many ways in 
> which
> mod_python module importing is broken:
> http://www.dscpl.com.au/articles/modpython-003.html
>
> I have a problem myself, and I'm interested if it is related to the 
> problems you
> explain in your article, or rather specific to my own Apache2 
> configuration.
>
> When I try to print sys.path, I get a wide variety of results that 
> suggest
> contamination of sys.path between Python scripts placed in different
> $USERDIR/public_html/ directories, like:
> 1st run:
> ['.', '/home/*/public_html/', '/usr/lib/python23.zip', 
> '/usr/lib/python2.3',
> '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk',
> '/usr/lib/python2.3/lib-dynload', 
> '/usr/local/lib/python2.3/site-packages',
> '/usr/lib/python2.3/site-packages', 
> '/usr/lib/python2.3/site-packages/Numeric',
> '/usr/lib/python2.3/site-packages/PIL',
> '/usr/lib/python2.3/site-packages/gtk-2.0', '/usr/lib/site-python']
> 2nd run (just a minute after):
> ['/home/marcin/public_html/gs/', '/usr/lib/python23.zip', 
> '/usr/lib/python2.3',
> '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk',
> '/usr/lib/python2.3/lib-dynload', 
> '/usr/local/lib/python2.3/site-packages',
> '/usr/lib/python2.3/site-packages', 
> '/usr/lib/python2.3/site-packages/Numeric',
> '/usr/lib/python2.3/site-packages/PIL',
> '/usr/lib/python2.3/site-packages/gtk-2.0', '/usr/lib/site-python']
> 3rd run (just another minute after):
> ['/usr/lib/python23.zip', '/usr/lib/python2.3',
> '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk',
> '/usr/lib/python2.3/lib-dynload', 
> '/usr/local/lib/python2.3/site-packages',
> '/usr/lib/python2.3/site-packages', 
> '/usr/lib/python2.3/site-packages/Numeric',
> '/usr/lib/python2.3/site-packages/PIL',
> '/usr/lib/python2.3/site-packages/gtk-2.0', '/usr/lib/site-python']
>
> Do you think these problems are related to what you write about, or is 
> it a
> completely different problem?
> -- 
> 	Sincerely
> 		Michal J. Gajda
> <misiek.vcf>



More information about the Mod_python mailing list