use "except x as y:" everywhere, for py3
This commit is contained in:
parent
4c4b5d081b
commit
cbc40697f7
|
@ -16,7 +16,7 @@ def get_db(dbfile, stderr=sys.stderr):
|
||||||
must_create = not os.path.exists(dbfile)
|
must_create = not os.path.exists(dbfile)
|
||||||
try:
|
try:
|
||||||
db = sqlite3.connect(dbfile)
|
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))
|
raise DBError("Unable to create/open db file %s: %s" % (dbfile, e))
|
||||||
db.row_factory = sqlite3.Row
|
db.row_factory = sqlite3.Row
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def get_db(dbfile, stderr=sys.stderr):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version = db.execute("SELECT version FROM version").fetchone()[0]
|
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.
|
# this indicates that the file is not a compatible database format.
|
||||||
# Perhaps it was created with an old version, or it might be junk.
|
# Perhaps it was created with an old version, or it might be junk.
|
||||||
raise DBError("db file is unusable: %s" % e)
|
raise DBError("db file is unusable: %s" % e)
|
||||||
|
|
|
@ -124,7 +124,7 @@ def run(args, stdout, stderr, executable=None):
|
||||||
#rc = command.func(args, stdout, stderr)
|
#rc = command.func(args, stdout, stderr)
|
||||||
rc = args.func(args)
|
rc = args.func(args)
|
||||||
return rc
|
return rc
|
||||||
except ImportError, e:
|
except ImportError as e:
|
||||||
print >>stderr, "--- ImportError ---"
|
print >>stderr, "--- ImportError ---"
|
||||||
print >>stderr, e
|
print >>stderr, e
|
||||||
print >>stderr, "Please run 'python setup.py build'"
|
print >>stderr, "Please run 'python setup.py build'"
|
||||||
|
|
|
@ -54,7 +54,7 @@ def _query(path, args, regex):
|
||||||
env=env)
|
env=env)
|
||||||
(output, err) = p.communicate()
|
(output, err) = p.communicate()
|
||||||
break
|
break
|
||||||
except OSError, e:
|
except OSError as e:
|
||||||
if e.errno == errno.EINTR and trial < TRIES-1:
|
if e.errno == errno.EINTR and trial < TRIES-1:
|
||||||
continue
|
continue
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in New Issue
Block a user