[mod_python] How to define an environment variable for otherpython module to use?

Gregory Trubetskoy grisha at modpython.org
Mon Aug 21 16:54:29 EST 2000


David - 

I just looked at the docs, and I didn't see the word "only" mentioned
anywhere.

Grisha


On Sat, 19 Aug 2000, David Yeung wrote:

> Gregory
> 
> According to the Python document, if os.putvar is used to change the
> environment, such changes only affect subprocesses started with
> os.system(), popen(), fork() and execv(), so it is probably not
> able to solve the problem.
> 
> Thanks
> 
> david
> 
> 
> Gregory Trubetskoy wrote:
> > 
> > Sorry for a late answer -
> > 
> > If you are using strictly mod_python (without cgihandler), then the
> > standard apache SetEnv or PassEnv directives should work.
> > 
> > If you're using cgihandler, and if the python-oracle interface module is
> > written in C, then most likely it uses the actual process environment. In
> > this case you will have to use os.putenv() function prior to using the
> > oracle interface. Otherwise, simply assigning something to os.environ
> > should do it.
> > 
> > Does this answer your question?
> > 
> > --
> >   Gregory (Grisha) Trubetskoy
> >        grisha at modpython.org
> > 
> > On Mon, 14 Aug 2000, David YEUNG wrote:
> > 
> > > I have other python modules which usually need to read some environment
> > > variables, e.g., an python-oracle interface module needs to read the "ORACLE_SID"
> > > to know where the database to connect. I used to defining this variable in the "shell"
> > > before invoking a python CGI program, e.g.:
> > >
> > >    #!/bin/sh
> > >    export ORACLE_SID=orcl
> > >    exec /some/oracle/python/interface.cgi
> > >
> > > I would like to try the mod_python using the default CGI handler, but does someone
> > > know how to define some environment variable in mod_python?
> > >
> > > Thanks
> > >
> > > david
> > > _______________________________________________
> > > Mod_python mailing list
> > > Mod_python at modpython.org
> > > http://www.modpython.org/mailman/listinfo/mod_python
> > >
> 




More information about the Mod_python mailing list