From dbe9ec8337097b4c2f88c17988a03d202df3ec9a Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Mon, 12 Nov 2007 21:02:08 +0000 Subject: [PATCH] fix for IOError unpack crash --- direct/src/task/Task.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index ba39bf151d..29f668a9b4 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -937,14 +937,20 @@ class TaskManager: self.step() except KeyboardInterrupt: self.stop() - except IOError, (errno, strerror): + except IOError, v: + # IOError unpack from http://www.python.org/doc/essays/stdexceptions/ + try: + (code, message) = v + except: + code = 0 + message = v # Since upgrading to Python 2.4.1, pausing the execution # often gives this IOError during the sleep function: # IOError: [Errno 4] Interrupted function call # So, let's just handle that specific exception and stop. # All other IOErrors should still get raised. # Only problem: legit IOError 4s will be obfuscated. - if errno == 4: + if code == 4: self.stop() else: raise