Output from subprocess.Popen()

Clodoaldo Pinto Neto clodoaldo.pinto at gmail.com
Mon Oct 16 12:46:55 EDT 2006


Now we have 3 different outputs from 3 people to the command:
>>> f = subprocess.Popen("set | grep IFS", shell=True,
                         stdout=subprocess.PIPE)
>>> f.stdout.readlines()

>From me on FC5:
["BASH_EXECUTION_STRING='set | grep IFS'\n", "IFS=' \t\n"]

>From Fredrik Lundh on unknown OS:
["IFS=$' \\t\\n'\n"]

>From Sion Arrowsmith on Debian 1:3.3.5-12:
["IFS=' \t\n"]

I found this problem while developing a CGI shell:
http://code.google.com/p/cgpy-shell/

Although the cgi-shell is working quite well, this issue is a show
stopper for that project. I need a stable/reliable output from Popen().
It looks like each bash or sh version outputs things differently, with
different escaping.

It is not a problem if there is only one or more than one line in the
returned list as i will always get the last one. The problem is the
escaping.




More information about the Python-list mailing list