[mod_python] How to let mod_python 3.2.8 generate and use .pyc file?

Graham Dumpleton grahamd at dscpl.com.au
Mon Mar 6 23:05:16 EST 2006

K.S.Chen wrote ..
> Hi,
> I used mod_python 3.1.3 for a while.
> In that version, publisher handler will compile the module and uses it
> later.
> In 3.2.8, this feature is replaced by an internal caching mechanism.
> Is it possible to turn on this feature so that .pyc file could be used
> also ?
> or could someone guide me a direction to do that ?

The short answer is that it is not possible. At least not for files directly
imported and managed by publisher. You could always separate out
most of your code into modules stored in a package somewhere on
standard sys.path and import them using standard "import" statement.
Such code though would no longer be a candidate for automatic
module reloading.

Do you have any data to show that not caching compiled byte code in
a .pyc file is somehow detrimental to performance?

BTW, usually Apache doesn't have write access to the directories anyway
and can't produce .pyc files.


More information about the Mod_python mailing list