From 8f2294477c1b3c62ec7e7384147c487d71a7ba81 Mon Sep 17 00:00:00 2001 From: Oren Tirosh Date: Fri, 15 May 2015 12:52:02 -0500 Subject: [PATCH] py3: do not use "except Exception, e:" syntax If catching the exception is done with "except Exception as e:" this will work only from 2.6. To maintain backward compatibility with 2.4 I have used sys.exc_info(). A bit of a wart, but it works. --- smem | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smem b/smem index 9157ce0..7020a27 100755 --- a/smem +++ b/smem @@ -725,7 +725,8 @@ try: showsystem() else: showpids() -except IOError, e: +except IOError: + _, e, _ = sys.exc_info() if e.errno == errno.EPIPE: pass except KeyboardInterrupt: