On Tue, Oct 20, 2009 at 02:49:53PM +0000, Tiago Saboga wrote: > 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,
It does help. I never knew this. I don't remember seeing this quirk before. Thanks. > > 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 _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor