[ python-Bugs-1057052 ] subprocess on Windows 2: unexpected failure
SourceForge.net
noreply at sourceforge.net
Sat Oct 30 17:46:36 CEST 2004
Bugs item #1057052, was opened at 2004-10-29 14:35
Message generated for change (Comment added) made by josiahcarlson
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1057052&group_id=5470
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Russell Owen (reowen)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess on Windows 2: unexpected failure
Initial Comment:
My understanding was that subprocess.py was supposed to be
backwards compatible with at least Python 2.3 if not 2.2. Wanting
subprocess and backwards compatibility, I grabbed the subprocess.py
from 2.4b1, changed the import if so that win32api was used (since I
had no _subprocess library!) and found several problems, of which
this is one (one per bug report):
The following code fails when run as a program on Windows Python
2.3.
However, the exact same code works perfectly on a unix build of
Python 2.4b1 on MacOS X. It also works on Windows if I use
an interactive interpreter and type each line in by hand (skipping
some irrelevant bits).
import subprocess
def xpaget(cmd, template="ds9"):
fullCmd = '"xpaget" %s %s' % (template, cmd,)
p = subprocess.Popen(
# executable = _XPADir + "xpaget", # use if bug in
subprocess gets fixed
args = fullCmd,
shell = True,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
cwd = _XPADir,
)
try:
p.stdin.close()
errMsg = p.stderr.read()
if errMsg:
raise RuntimeError('%r failed: %s' % (fullCmd, errMsg))
reply = p.stdin.read() # the code fails here; the next print
statement never executes
print "xpaget read %r" % reply
return reply
finally:
p.stdout.close()
p.stderr.close()
----------------------------------------------------------------------
Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-10-30 08:46
Message:
Logged In: YES
user_id=341410
You may want to repost that with indentation (the original
bug report always loses indentation).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1057052&group_id=5470
More information about the Python-bugs-list
mailing list