Issue1057052
Created on 2004-10-29 21:35 by reowen, last changed 2004-11-07 16:00 by astrand. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg22944 - (view) | Author: Russell Owen (reowen) | Date: 2004-10-29 21:35 | |
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()
|
|||
| msg22945 - (view) | Author: Josiah Carlson (josiahcarlson) | Date: 2004-10-30 15:46 | |
Logged In: YES user_id=341410 You may want to repost that with indentation (the original bug report always loses indentation). |
|||
| msg22946 - (view) | Author: Peter Åstrand (astrand) * ![]() |
Date: 2004-11-07 16:00 | |
Logged In: YES user_id=344921 The bug report doesn't actually say which kind of traceback or error message is generated, but the problem is most likely caused by the application: It tries to read from p.stdin after it has been closed. Closing. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2004-10-29 21:35:22 | reowen | create | |
