[mod_python] Returned filename question

Graham Dumpleton grahamd at dscpl.com.au
Fri Jan 5 19:34:04 EST 2007


On 05/01/2007, at 9:32 PM, Martijn Moeling wrote:

> I see,
>
> I have no .py's in my www/html at all, since I have used
> mod_python.importer.path. index.py is a static link to the correct
> python module in the configured directory.
>
> I use PythonOptimeize On and I. What if I upload .pyc files to my
> production server? Does it influence performance?

Where the new module importer is what is doing the importing, ie., it
is something not on sys.path, even if there were .pyc files they would
be ignored.

For stuff on sys.path managed by standard Python module importer,
it may use such .pyc files, but given long running nature of Apache
processes anyway, any benefit wouldn't be anything that you notice as
it only comes into play once when module first loaded.

In short, don't go out of your way to generate and upload .pyc files
as it isn't going to make a noticeable difference.

Graham

> Martijn
>
> -----Oorspronkelijk bericht-----
> Van: Graham Dumpleton [mailto:grahamd at dscpl.com.au]
> Verzonden: Thursday, January 04, 2007 10:22 PM
> Aan: Martijn Moeling
> CC: mod_python at modpython.org
> Onderwerp: Re: [mod_python] Returned filename question
>
> Martijn Moeling wrote ..
>> One other Interesting thing is that since I started to compile MP
> myself
>> (not using standard installed or RMP versions). The creation of .pyc
>> (and or .pyo) files stopped working. I have read some articles in the
>> mailinglist archives I found about that, but they seem to be
> protection
>> related, and I have not changed a bit other than an upgrade to Python
>> 2.5 and then an upgrade of MP to 3.3.0b, any suggestions?
>
> In mod_python 3.3, the new module importer does not use the standard
> Python module importer mechanisms for dealing with file based modules
> which are to be candidates for module reloading. As a consequence, you
> will no longer see .pyc or .pyo files. Such files were often a  
> security
> hole
> anyway, as many didn't properly setup Apache so as to prevent users
> from downloading them. As a consequence, someone could decompile
> them and perhaps get sensitive information out of them.
>
> Graham


More information about the Mod_python mailing list