[Tutor] trouble setting the environment

Kent Johnson kent37 at tds.net
Thu Apr 21 22:20:29 CEST 2005


Ertl, John wrote:
> All,
> 
> I have program and init I want to "source" a .ksh file to set some
> environment variables and then use those variables in my program.
> 
> Is this possible? I vaguely remember something about the system env and the
> interpreters env being separate after the interpreter starts up.

What about making a shell file that sources your ksh file, then starts python?

Kent

> 
> For instance if I have a .ksh file called envSet.ksh:
> 
> #!/bin/ksh
> 
> unset OPSBIN
> 
> export OPSBIN=/u/ops/bin 
> 
> ---end --
> 
> Then 
>  
> 
>>>>os.system(". envSet.ksh")
> 
> 0
> 
>>>>os.getenv("OPSBIN")
>>>>
> 
> 
> What is the 0.  I know that I can set the env using Python but all of the
> correct env are in the .ksh files maintained by others.  I would hate to
> have to take the .ksh and tread each line and if it is an export turn that
> into a python  os.environ statement.
> 
> Any ideas.
> 
> Thanks 
> 
> John 
>        
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list