IOError: [Errno 4] Interrupted system call

chadrik at gmail.com chadrik at gmail.com
Fri Feb 16 16:07:40 EST 2007


i don't have any signal handlers in my code, but i have no idea what
is going on in the internals of the pyQt framework that i'm using for
the GUI.

as far as simply ignoring the exception, that does not seem to work.
for instance, here's some code i've tried:


p = subprocess.Popen('mycommand', shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, close_fds=True)
output = ''
tries = 0
while tries < 12:
	try:
		tries = tries+1
		print "retrieving results"
		output = p.stdout.readlines()

	except IOError:
		print "IOError! try %s" % tries
		print "output:", output
		#time.sleep(1)
	else:
		print "Great Success"
		print "output:", output
		break


--printout: successful run--
retrieving results
Great Success
output: []

--printout: IOError run--
retrieving results
IOError! try 1
output:
retrieving results
Great Success
output: []

if the first try raises an error output does not get set and then the
second try succeeds but returns an empty list when it should return
results. moving the Popen inside the loop isn't an option either,
because, in addition to returning results, the command performs an
action which should only run once.

sorry if i'm missing something obvious here, i'm a python newb.

-chad







More information about the Python-list mailing list