From a5be53f9c809009e67f217c00b8f30246aacc237 Mon Sep 17 00:00:00 2001 From: Sarah Owens Date: Sun, 9 Sep 2012 15:37:57 -0700 Subject: Use modern Python exception syntax "except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803 --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 278fd36f..d993ee4e 100755 --- a/main.py +++ b/main.py @@ -146,13 +146,13 @@ class _Repo(object): else: print >>sys.stderr, 'real\t%dh%dm%.3fs' \ % (hours, minutes, seconds) - except DownloadError, e: + except DownloadError as e: print >>sys.stderr, 'error: %s' % str(e) return 1 - except ManifestInvalidRevisionError, e: + except ManifestInvalidRevisionError as e: print >>sys.stderr, 'error: %s' % str(e) return 1 - except NoSuchProjectError, e: + except NoSuchProjectError as e: if e.name: print >>sys.stderr, 'error: project %s not found' % e.name else: @@ -390,14 +390,14 @@ def _Main(argv): close_ssh() except KeyboardInterrupt: result = 1 - except RepoChangedException, rce: + except RepoChangedException as rce: # If repo changed, re-exec ourselves. # argv = list(sys.argv) argv.extend(rce.extra_args) try: os.execv(__file__, argv) - except OSError, e: + except OSError as e: print >>sys.stderr, 'fatal: cannot restart repo after upgrade' print >>sys.stderr, 'fatal: %s' % e result = 128 -- cgit v1.2.3-54-g00ecf