mod_python req.subprocess_env not "seeing" PythonOptions
- by Brandon
I'm having trouble getting an environmental variable out of apache config. (don't ask why it's being done this way, I didn't originally code it)
This is what I have in the apache config.
<Location "/var/www">
SetHandler python-program
PythonHandler mod_python.publisher
PythonOption MYSQL_PWD ###########
PythonDebug On
</Location>
This is the problem code...
#this is the problem code in question.
def index(req):
req.add_common_vars()
os.environ["MYSQL_PWD"] = req.subprocess_env["MYSQL_PWD"]
req.content_type = "text/html"
statText = getStatText()
here is the traceback I'm getting from executing this.
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/usr/lib/python2.5/site-packages/mod_python/publisher.py", line 213, in handler
published = publish_object(req, object)
File "/usr/lib/python2.5/site-packages/mod_python/publisher.py", line 425, in publish_object
return publish_object(req,util.apply_fs_data(object, req.form, req=req))
File "/usr/lib/python2.5/site-packages/mod_python/util.py", line 554, in apply_fs_data
return object(**args)
File "/var/www/admin/Stat.py", line 299, in index
os.environ["MYSQL_PWD"] = req.subprocess_env["MYSQL_PWD"]
KeyError: 'MYSQL_PWD'