Clodoaldo Pinto Neto wrote:
> Output from the shell:
>
> [EMAIL PROTECTED] teste]$ set | grep IFS
> IFS=$' \t\n'
>
> Output from subprocess.Popen():
>
>>>> import subprocess as sub
>>>> p = sub.Popen('set | grep IFS', shell=True, stdout=sub.PIPE)
>>>> p.stdout.readlines()[1]
> "IFS=' \t\n"
>
> Both outputs for comparison:stdout=subprocess.PIPE)
> IFS=$' \t\n'
> "IFS=' \t\n"
>
> The subprocess.Popen() output is missing the $ and the last '
if you expect one line of output, why are you doing readlines()[1] ?
>>> f = subprocess.Popen("set | grep IFS", shell=True,
>>> f.stdout.readlines()[1]
Traceback (most recent call last):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
this works for me:
>>> f = subprocess.Popen("set | grep IFS", shell=True,
stdout=subprocess.PIPE)
>>> f.stdout.readlines()
["IFS=$' \\t\\n'\n"]
what does the above return on your machine?
</F>
--
http://mail.python.org/mailman/listinfo/python-list