[Tutor] updating Unix config file

Matt Herzog msh at blisses.org
Tue Oct 20 18:58:27 CEST 2009

On Tue, Oct 20, 2009 at 02:49:53PM +0000, Tiago Saboga wrote:
> On Tue, Oct 20, 2009 at 2:44 PM, Matt Herzog <msh at 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,

It does help. I never knew this. I don't remember seeing this quirk before.


> Tiago Saboga.

The test of a first-rate intelligence is the ability to hold two opposed ideas in the mind at the same time, and still retain the ability to function.

-- F. Scott Fitzgerald

More information about the Tutor mailing list