Re: How to pass shell variable to shell script from python

2008-02-27 Thread D'Arcy J.M. Cain
On Wed, 27 Feb 2008 15:37:25 +0800 "Rockins Chen" <[EMAIL PROTECTED]> wrote: > Clearly, I made some typing mistake, it's the shbang line! it should be: > #!/usr/bin/python Side topic - if you want portability use the following: #! /usr/bin/env python -- D'Arcy J.M. Cain <[EMAIL PROTECTED]>

Re: How to pass shell variable to shell script from python

2008-02-27 Thread Philipp Pagel
Gerardo Herzig <[EMAIL PROTECTED]> wrote: > Rockins Chen wrote: > Well, if you have to use os.system, that could be > os.system("export target=localhost.localdomain.org; ./callee.sh") Or os.system("env target=localhost.localdomain.org ./callee.sh") cu Philipp -- Dr. Philipp Pagel Lehrst

Re: How to pass shell variable to shell script from python

2008-02-27 Thread Gerardo Herzig
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.envir

Re: How to pass shell variable to shell script from python

2008-02-27 Thread Christian Heimes
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.

Re: How to pass shell variable to shell script from python

2008-02-26 Thread Rockins Chen
Clearly, I made some typing mistake, it's the shbang line! it should be: #!/usr/bin/python then, just set os.environ is okay: os.environ["target"] = "localhost.localdomain.org" according python's documentation, setting os.environ will implicitly call os.putenv(). 2008/2/27, Rockins Chen <[EMAIL

How to pass shell variable to shell script from python

2008-02-26 Thread Rockins Chen
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: