From fbd07d8a7cf88daf5d821601578d2f7bc1c92928 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Tue, 18 Mar 2014 12:47:35 +0100 Subject: Python 3: Replace "except Exception, exc" with "except Exception as exc:" --- paste/util/PySourceColor.py | 2 +- paste/util/import_string.py | 4 ++-- paste/util/scgiserver.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'paste/util') diff --git a/paste/util/PySourceColor.py b/paste/util/PySourceColor.py index d9f451f..64c0f56 100644 --- a/paste/util/PySourceColor.py +++ b/paste/util/PySourceColor.py @@ -1311,7 +1311,7 @@ class Parser(object): # Parse the source and write out the results. try: tokenize.tokenize(text.readline, self) - except tokenize.TokenError, ex: + except tokenize.TokenError as ex: msg = ex[0] line = ex[1][0] self.out.write("

ERROR: %s

%s\n"% diff --git a/paste/util/import_string.py b/paste/util/import_string.py index 3feb4dd..a10db18 100644 --- a/paste/util/import_string.py +++ b/paste/util/import_string.py @@ -47,7 +47,7 @@ def simple_import(s): try: module = import_module(name) parts = parts[1:] - except ImportError, e: + except ImportError as e: last_import_error = e break obj = module @@ -79,7 +79,7 @@ def try_import_module(module_name): """ try: return import_module(module_name) - except ImportError, e: + except ImportError as e: if not getattr(e, 'args', None): raise desc = e.args[0] diff --git a/paste/util/scgiserver.py b/paste/util/scgiserver.py index d20c952..7963ed6 100644 --- a/paste/util/scgiserver.py +++ b/paste/util/scgiserver.py @@ -131,7 +131,7 @@ class SWAP(scgi_server.SCGIHandler): input.close() output.close() conn.close() - except IOError, err: + except IOError as err: debug("IOError while closing connection ignored: %s" % err) -- cgit v1.2.1