Graham Dumpleton
grahamd at dscpl.com.au
Wed May 18 19:05:45 EDT 2005
dharana wrote .. > Is it possible to get the version mod_python is currently running? > > (Background: an script that checks all necessary packages are available > and that they are at least x.y.z version) I may be missing the obvious, but don't recollect ever seeing a version tag and couldn't find when I looked again just then. Is this script mean't to be able to run on a command line or is executing under mod_python itself? The problem with trying to run a standalone script to determine something about mod_python is that mod_python will not fully load if not imported from within the context of an interpretor running under Apache. The best I have managed to come up with as a guide to determining which version of mod_python is to try and import the psp module and see what sort of import error occurs. See the description in: http://www.dscpl.com.au/projects/vampire/articles/modpython-001.html#version-number >From code running under mod_python itself, there are a few subtle differences in member data present in the request object which one can used to determine between 2.7 and 3.1. For example: if hasattr(req,"hlist"): # In mod_python 3.X have the req.hlist member. handler_root = req.hlist.directory elif hasattr(req,"get_dirs"): # In mod_python 2.X have the req.get_dirs() method. handler_root = req.get_dirs()["PythonHandler"] Don't know if this helps or not. Graham
|