Problem using subprocess.Popen on windows

jorma kala jjkk73 at
Sun Oct 7 12:07:32 CEST 2007


I get an error that I don't understand when using the subprocess module on
I guess I'm missing out something very basic.
For instance, to execute and capture the output of the ms-dos dir command, I
tried the following:

from subprocess import *

p1 = Popen(["dir"],  stdout=PIPE)
output = p1.communicate()[0]

But I get a WindowsError : [Error 2]  File Not Found

The exact traceback is :

Traceback (most recent call last):
  File "", line 5, in <module>
    p1 = Popen(["dir"],  stdout=PIPE)
  File "C:\Python25\lib\", line 593, in __init__
    errread, errwrite)
  File "C:\Python25\lib\", line 815, in _execute_child
WindowsError: [Error 2] Le fichier spÚcifiÚ est introuvable

Do you know what is missing in my code?

Thanks a lot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list