[mod_python] environment variables not visible?

Steven D. Arnold stevena at neosynapse.net
Thu Mar 27 11:26:34 EST 2003


On 3/27/03 8:04 AM, "Gregory (Grisha) Trubetskoy" <grisha at modpython.org>
wrote:

> I am guessing you are using the cgihandler. You can't see environment
> variables from within the cgihandler-executed CGI scripts, it's mentioned
> here:
> 
> http://www.modpython.org/live/current/doc-html/hand-cgi.html

I saw this post, but it doesn't seem I am using that.  Here's the section of
the config:

#AddHandler spyce-cgi-handler spy
#Action spyce-cgi-handler "/spyce-cgi/run_spyceCGI.py"
#ScriptAlias /spyce-cgi/ "/usr/share/spyce/cgi/"
<IfModule mod_python.c>
  AddHandler python-program .spy
  PythonHandler run_spyceModpy::spyceMain
  PythonPath 
"sys.path+[r'/usr/share/spyce/cgi','/server/unr/spyce_modules']"
  PythonOption SPYCE_CONFIG "/usr/share/spyce/spyce.conf"
  # !!! Do NOT turn on. !!!
  PythonOptimize Off
  SetEnv SYBASE /server/sybase/ASE_12501_2
  SetEnv LD_LIBRARY_PATH
/server/sybase/ASE_12501_2/OCS-12_5/lib:/usr/local/lib
  SetEnv SYBASE_OCS /server/sybase/ASE_12501_2/OCS-12_5
  SetEnv SYBASE_ASE /server/sybase/ASE_12501_2/ASE-12_5
</IfModule>
## Following Directives commented out for Mod_python testing
## 03/25/03
#<Location /spyce-cgi/>
#  <IfModule mod_fastcgi.c>
#    # If mod_fastcgi not installed, we get plain cgi
#    SetHandler fastcgi-script
#  </IfModule>
#</Location>
# If FastCGI is installed, it will be picked up
# automatically. On Linux, you can also omit this section
# and use a dynamic fcgi server instead.
#<IfModule mod_fastcgi.c>
#  FastCgiServer "/usr/share/spyce/cgi/run_spyceCGI.py" -port 7654
-initial-env F
#CGI_PORT=7654
#</IfModule>

Note the SetEnv directives are used in addition to setting the environment
with os.environ, but neither of these approaches work.  I am not familiar
enough with the internals of mod_python, but it seems perhaps
run_spyceModpy::spyceMain is the mon_python handler and perhaps it is
somehow forgetting the environment variables.  Does this seem like a likely
possibility to you?

Thanks,
steve
-- 





More information about the Mod_python mailing list