Message 145764 - Python tracker (original) (raw)
A better fix, which supports multiple windows commands:
if mswindows:
pipe = os.popen('( ' + cmd + ' ) 2>&1', 'r') # Windows uses () rather than { }
else:
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
This works with the command
subprocess.getoutput("echo before & python -V & echo after")
Note that python -V writes to stderr, so without the enclosing ( ) the version information is not captured.