Output from subprocess.Popen()

Sion Arrowsmith siona at chiark.greenend.org.uk
Mon Oct 16 15:53:36 CEST 2006


Clodoaldo Pinto Neto <clodoaldo.pinto at gmail.com> wrote:
>Fredrik Lundh wrote:
>> 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 = subprocess.Popen("set | grep IFS", shell=True, stdout=subprocess.PIPE)
>>>> f.stdout.readlines()
>["BASH_EXECUTION_STRING='set | grep IFS'\n", "IFS=' \t\n"]
>
>I'm on FC5

OK, there's something going on here:
$ set | grep IFS
IFS=$' \t\n'
$ python
Python 2.4.1 (#2, May  5 2005, 11:32:06)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> f = subprocess.Popen("set | grep IFS", shell=True, stdout=subprocess.PIPE)
>>> f.stdout.readlines()
["IFS=' \t\n"]
>>>

(Hmph, I don't have any other non-Windows boxes with >=2.4 to hand.)

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list