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
diff --git a/main.py b/main.py
index 278fd36..d993ee4 100755
--- a/main.py
+++ b/main.py
@@ -146,13 +146,13 @@
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 @@
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