[Tutor] Popen problem with a pipe sign "|"

Sander Sweers sander.sweers at gmail.com
Sat Jul 4 18:57:09 CEST 2009


Again, You need to also post to the list!!

On Fri, 2009-07-03 at 22:32 -0400, Shawn Gong wrote:
> I see what you mean. However in my case the | sign simply constitute an 
> argument. I'm actually calling devenv.com, which is the MS VS2005's building 
> command. The whole command looks like:
> "...\devenv.com" solution.sln /build "Debug|Win32"
> If I sub "Debug|Win32" with Debug only, it works fine. But whenever I add 
> the |, nothing seems to run.

Ah, ok now I get what your problem is.

I do not know why that would not work. Can you show the actual code you
have? Do you have the command in a list? See below an *untested*
example, does this work?

command = ['C:\\...\\devenv', 'solution.sln', '/build', 'Debug|Win32']
proc = subprocess.Popen(command,
                        stdout=subporcess.PIPE,
                        stderr=subporcess.PIPE,
                        stdin=subporcess.PIPE)

stdout, stderr = proc.communicate()



More information about the Tutor mailing list