mod_python

Skip Montanaro skip at pobox.com
Fri Jan 31 11:09:48 EST 2003


    >> If you see any behaviour you don't expect with mod_python, I highly
    >> recommend that you restart the apache server that contains it.

    Kristoffer> Is there really no other way around like autoreloading or so
    Kristoffer> like mod_ruby does ?

Reloading modules on a large scale is fairly fragile.  You can get fairly
heavy-handed and force the reload of modules written in Python by fiddling
with sys.modules, but you can't be sure you've eliminated all references to
old versions.  For example:

    >>> import string
    >>> replace = string.replace
    >>> reload(string)
    <module 'string' from '/Users/skip/local/lib/python2.3/string.pyc'>
    >>> replace == string.replace
    False

If my interpretation of previous posts on this subject is correct, there is
no effective (cross-platform) way to properly unload and reload extension
modules, that is I don't believe dlclose("bsddb.so") necessarily disconnects
the .so file from the running interpreter so that a later dlopen("bsddb.so")
forces the dynamic linker to do its complete dance again.

Skip





More information about the Python-list mailing list