stephen_b wrote:
> Can someone let me know why this won't work? Thanks.
>
>
>>>>from os import popen
>>>>popen('export asdfasdf=hello').read()
>
> ''
>
>>>>popen('echo $asdfasdf').read()
>
> '\n'
>
> Thanks.
>
> Stephen
>
Python starts a new shell for each command, so your environment variable
is lost. You probably want this, which makes the variable "permanent".
py> import os
py> os.environ['asdfasdf'] = 'hello'
py> os.popen('echo $asdfasdf').read()
'hello\n'
James
--
http://mail.python.org/mailman/listinfo/python-list