[Python-de] subprocess: stdin=NULL

Thomas Guettler guettli at thomas-guettler.de
Do Okt 6 21:24:50 CEST 2011


On 06.10.2011 10:58, Thomas Rachel wrote:
> Am 27.09.2011 15:14 schrieb Thomas Guettler:
>
>> Hier habe ich einen Hinweis gefunden:
>> http://bugs.python.org/issue1220113
>>
>> subprocess.Popen(...stdin=open('/dev/null'))
>>
>> Das funktioniert für mich (linux only). Aber prinzipiell wäre ein
>> NULL analog zu PIPE doch schöner.
>>
>> Gibt es dafür schon eine portable Lösung?
>
> Nimm eine PIPE und schließe das schreibende Ende unmittelbar.
>
> sp = subprocess.Popen(...stdin=subprocess.PIPE)
> sp.stdin.close()

Ja, stimmt. Danke für den Vorschlag.

   Thomas


Mehr Informationen über die Mailingliste python-de