TT#80825 utils/kamctl/dbtextdb/dbtextdb.py: fix exception usage with python3

Fails due to:

| Traceback (most recent call last):
|   File "/usr/lib/x86_64-linux-gnu/kamailio/kamctl/dbtextdb/dbtextdb.py", line 1239, in <module>
|     main(sys.argv)
|   File "/usr/lib/x86_64-linux-gnu/kamailio/kamctl/dbtextdb/dbtextdb.py", line 1233, in main
|     except (Error, e):
| NameError: name 'e' is not defined

Change-Id: I09ed6d0bd1b6fdad5f9b04cd54fef1ee43a44312
changes/07/39807/1
Michael Prokop 6 years ago
parent 02ba8431d5
commit 00e482f661

@ -76,6 +76,7 @@ sipwise/rtpengine-flags-for-everything.patch
sipwise/pv_headers-full-rework.patch
sipwise/pua_dialoginfo-refresh_pubruri_avps_flag.patch
sipwise/pua_dialoginfo-local_identity_dlg_var.patch
sipwise/dbtextdb_fix_exception_handling
#
### Don't just put stuff in any order
### use gbp pq import/export tooling to help maintain patches

@ -0,0 +1,35 @@
--- a/utils/kamctl/dbtextdb/dbtextdb.py
+++ b/utils/kamctl/dbtextdb/dbtextdb.py
@@ -993,12 +993,12 @@
try:
if val:
val = eval(val)
- except (NameError, e):
+ except NameError as e:
raise ExecuteError('Failed to parse %s in %s '
'(unable to convert to type %s): %s' %
(col, self.table, self.header[col]['type'],
e))
- except (SyntaxError, e):
+ except SyntaxError as e:
raise ExecuteError('Failed to parse %s in %s '
'(unable to convert to type %s): %s' %
(col, self.table, self.header[col]['type'],
@@ -1083,7 +1083,7 @@
# save a copy of the data before modifying
self.orig_data = self.data[:]
- except (IOError, e):
+ except IOError as e:
raise ExecuteError('Unable to open table %s: %s' % (self.table, e))
Debug('Header is: %s' % self.header)
@@ -1230,7 +1230,7 @@
print('Updated %s, rows affected: %d' % (conn.table, row))
else:
print(row)
- except (Error, e):
+ except Error as e:
print(e)
sys.exit(1)
Loading…
Cancel
Save