Mercurial Hosting > traffic-intelligence
diff python/utils.py @ 344:14a2405f54f8
slight modification to safety analysis and generalized script to delete computed data (objects and interactions)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 21 Jun 2013 17:32:57 -0400 |
parents | c9201f6b143a |
children | c64a4f889b97 |
line wrap: on
line diff
--- a/python/utils.py Fri Jun 21 15:28:59 2013 -0400 +++ b/python/utils.py Fri Jun 21 17:32:57 2013 -0400 @@ -455,11 +455,17 @@ # sqlite ######################### +def printDBError(error): + print('DB Error: {}'.format(error)) + def dropTables(connection, tableNames): 'deletes the table with names in tableNames' - cursor = connection.cursor() - for tableName in tableNames: - cursor.execute('DROP TABLE '+tableName) + try: + cursor = connection.cursor() + for tableName in tableNames: + cursor.execute('DROP TABLE '+tableName) + except sqlite3.OperationalError as error: + printDBError(error) ######################### # running tests