Clearly, I made some typing mistake, it's the shbang line! it should be:<br>#!/usr/bin/python<br><br>then, just set os.environ is okay:<br>os.environ["target"] = "<a href="http://localhost.localdomain.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">localhost.localdomain.org</a>"<br>
<br>according python's documentation, setting os.environ will implicitly call os.putenv().<br><br><div><span class="gmail_quote">2008/2/27, Rockins Chen <<a href="mailto:ybc2084@gmail.com">ybc2084@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br><br>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:<br>
<br>caller.py<br>------------------<br>#/usr/bin/python<br><br>import os<br><br>os.environ["target"] = "<a href="http://localhost.localdomain.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">localhost.localdomain.org</a>"<br>
os.putenv("target", "<a href="http://localhost.localdomain.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">localhost.localdomain.org</a>")<br>
os.system("./callee.sh")<br>
-------------------<br><br>callee.sh<br>-------------------<br>#!/bin/bash<br><br>echo $target<br>exit 0<br>--------------------<br><br>But, unluckily, it didn't work. What can I do?<br><br>TIA,<br clear="all"><br clear="all">

<br>-- <br>BRs,<br>Rockins Chen<br><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>UESTC, Chengdu, Sichuan, China<br><a href="http://www.dormforce.net/blog/rockins" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.dormforce.net/blog/rockins</a><br>

<a href="http://rockins.cublog.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://rockins.cublog.cn</a><br>
<a href="mailto:ybc2084@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ybc2084@gmail.com</a>
</blockquote></div><br><br clear="all"><br>-- <br>BRs,<br>Rockins Chen<br><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>UESTC, Chengdu, Sichuan, China<br><a href="http://www.dormforce.net/blog/rockins">http://www.dormforce.net/blog/rockins</a><br>
<a href="http://rockins.cublog.cn">http://rockins.cublog.cn</a><br><a href="mailto:ybc2084@gmail.com">ybc2084@gmail.com</a>