use "except x as y:" everywhere, for py3

This commit is contained in:
Brian Warner 2015-09-26 17:47:13 -07:00
parent 4c4b5d081b
commit cbc40697f7
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ def get_db(dbfile, stderr=sys.stderr):
must_create = not os.path.exists(dbfile)
try:
db = sqlite3.connect(dbfile)
except (EnvironmentError, sqlite3.OperationalError), e:
except (EnvironmentError, sqlite3.OperationalError) as e:
raise DBError("Unable to create/open db file %s: %s" % (dbfile, e))
db.row_factory = sqlite3.Row
@ -29,7 +29,7 @@ def get_db(dbfile, stderr=sys.stderr):
try:
version = db.execute("SELECT version FROM version").fetchone()[0]
except sqlite3.DatabaseError, e:
except sqlite3.DatabaseError as e:
# this indicates that the file is not a compatible database format.
# Perhaps it was created with an old version, or it might be junk.
raise DBError("db file is unusable: %s" % e)

View File

@ -124,7 +124,7 @@ def run(args, stdout, stderr, executable=None):
#rc = command.func(args, stdout, stderr)
rc = args.func(args)
return rc
except ImportError, e:
except ImportError as e:
print >>stderr, "--- ImportError ---"
print >>stderr, e
print >>stderr, "Please run 'python setup.py build'"

View File

@ -54,7 +54,7 @@ def _query(path, args, regex):
env=env)
(output, err) = p.communicate()
break
except OSError, e:
except OSError as e:
if e.errno == errno.EINTR and trial < TRIES-1:
continue
raise