This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author reowen
Recipients
Date 2004-10-29.21:35:22
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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()
History
Date User Action Args
2007-08-23 14:27:11adminlinkissue1057052 messages
2007-08-23 14:27:11admincreate