[Tutor] updating Unix config file

Steve Willoughby steve at alchemy.com
Tue Oct 20 16:53:17 CEST 2009

On Tue, Oct 20, 2009 at 10:44:16AM -0400, Matt Herzog 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's always been like that.  Otherwise we'd have lots of collisions between module global
names that namespaces are designed to avoid in the first place.  So you either name them
explicitly, or import them explicitly:

import subprocess
# now you can reference subprocess.PIPE


from subprocess import Popen, PIPE
# now you can reference PIPE without the namespace identifier


from subprocess import *
# but I don't recommend this one (caution! danger!)

More information about the Tutor mailing list