On Tue, Oct 20, 2009 at 2:44 PM, Matt Herzog <m...@blisses.org> wrote:
> Yes, thanks. What failed was the invocation of PIPE. Apparently I had to 
> explicitly import PIPE from subprocess or python had no clue as to what PIPE 
> was!
>
> Dare I say, "wtf?" since when fo I have to specify such? Shouldn't importing 
> the subprocess module make all its methods available? I can't remember having 
> to do this before.

It is really like any other module. If you just import subprocess, you
can access all its methods and attributes by spelling it out:

import subprocess
handler = subprocess.Popen(['cat'], stdout=subprocess.PIPE,
stdin=subprocess.PIPE)

Or you can import just the names you will use in the global namespace:

from subprocess import Popen, PIPE
handler = Popen(['cat'], stdout=PIPE, stdin=PIPE)

HTH,

Tiago Saboga.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to