Mercurial > repos > jjohnson > query_tabular
diff query_tabular.py @ 22:bed5018e7ae3 draft
Uploaded
author | jjohnson |
---|---|
date | Mon, 17 Jul 2017 15:22:04 -0400 |
parents | ab27c4bd14b9 |
children |
line wrap: on
line diff
--- a/query_tabular.py Fri Jul 14 17:34:22 2017 -0400 +++ b/query_tabular.py Mon Jul 17 15:22:04 2017 -0400 @@ -66,8 +66,7 @@ outputPath = os.path.abspath(options.output) outputFile = open(outputPath, 'w') except Exception as e: - print("failed: %s" % e, file=sys.stderr) - exit(3) + exit('Error: %s' % (e)) else: outputFile = sys.stdout @@ -109,8 +108,8 @@ if 'tables' in tdef: for ti, table in enumerate(tdef['tables']): _create_table(ti, table) - except Exception as exc: - print("Error: %s" % exc, file=sys.stderr) + except Exception as e: + exit('Error: %s' % (e)) query = None if (options.query_file is not None): @@ -124,15 +123,14 @@ if (query is None): try: describe_tables(get_connection(options.sqlitedb), outputFile) - except Exception as exc: - print("Error: %s" % exc, file=sys.stderr) + except Exception as e: + exit('Error: %s' % (e)) else: try: run_query(get_connection(options.sqlitedb), query, outputFile, no_header=options.no_header) - except Exception as exc: - print("Error: %s" % exc, file=sys.stderr) - exit(1) + except Exception as e: + exit('Error: %s' % (e)) if __name__ == "__main__":