Christian wrote: >>The closest thing you can do is that: >> >>-myScript.py-------------------------------------- >>print 'export MY_VARIABLE=value' >>-------------------------------------------------- >> >>-myScript.sh-------------------------------------- >>python myScript.py > /tmp/chgvars.sh >>. /tmp/chgvars.sh >>-------------------------------------------------- > > > Can I write a .py script that calls a .sh script that executes the > export command and then calls another .py script (and how would the > first .py script look)? > > That would be much more what is my basic problem. > You can do what you suggest without shell scripting, unless I misunderstand your intention: just set the environment variables you want your Python script to see and then run it using os.system():
:::::::::::::: one.py :::::::::::::: import os os.environ['STEVE'] = "You are the man" os.system("python two.py") print "Ran one" :::::::::::::: two.py :::::::::::::: import os print "STEVE is", os.environ['STEVE'] print "Ran two" [EMAIL PROTECTED] tmp]$ python one.py STEVE is You are the man Ran two Ran one [EMAIL PROTECTED] tmp]$ Hope this helps. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list