How to pass shell variable to shell script from python

Christian Heimes lists at cheimes.de
Wed Feb 27 11:53:31 CET 2008


Rockins Chen wrote:
> Hi all,
> 
> I encountered a problem: I have a python script, let's just name it
> caller.py, It calls a shell script, which is named callee.sh. In callee.sh,
> it need a shell variable $target, which should be supplied by caller.py(cannot
> pass by argument). I try to use os.environ to do this, as follows:

Don't use os.system or the popen functions. They have been substituted
with the subprocess module. It has a way to pass a new environment to a
process.

Christian




More information about the Python-list mailing list