[mod_python] Mod_python & cPickle / saving Instances

Dominique.Holzwarth at ch.delarue.com Dominique.Holzwarth at ch.delarue.com
Tue Apr 1 08:54:49 EDT 2008

>  Pickle would work tho, if I add my own modules to the PYTHONPATH (sys.modules thingy) so that they are loaded by the standard python module loader? Is that correct?

Correct. Those in normal Python modules picked up from sys.path can be used.

In general though recommend only using basic Python types, dictionaries, lists etc. This is though just to avoid potential for problem, not that there is still a problem. Just make sure stuff you want to pickle is in modules on sys.path.

>  However, using the standard python module loader for own modules will cause some mod_python problems as stated in http://www.dscpl.com.au/wiki/ModPython/Articles/ModuleImportingIsBroken ?

Which things in particular are you talking about? The problems in that document refer to pre mod_python 3.3.1. I can't think of any specific issues with use of standard modules that would cause a problem for you in mod_python 3.3.1.

--> I didn't mean standard python modules. I meant my _own_ modules and was talking about what effects it has when I add them to sys.path so that the 'standard python module loader' will do the import, rather than the mod_python 'loader'.

The thing is: As I understood it, if I just add my own modules to the sys.path they will be imported by 'standard python' (other than 'mod_python') and thus pickling would work. However, with the new mod_python import mechanism, my own modules shouldn't be added to sys.path as this mixing of paths could cause problems to mod_python or so...
At least that's what I have read in: http://www.modpython.org/pipermail/mod_python/2006-November/022726.html (and in there, you posted the above article :-))


More information about the Mod_python mailing list