calling ksh script from python

Magnus Lycka lycka at carmen.se
Wed Jun 8 11:07:47 CEST 2005


ronan_boisard at yahoo.com wrote:
> thanks for your input...
> well I just find out that modifying environment through ksh call is not
> possible (can't get the new evironment back to python). 

I thought about this a few days ago. Can't you copy it like this:

import os

env_rows = os.popen('. some.script > /dev/null; env).readlines()
for row in env_rows:
     var, val = row.split('=',1)
     os.environ[var]=val





More information about the Python-list mailing list