diff sqlite_to_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/sqlite_to_tabular.py	Fri Jul 14 17:34:22 2017 -0400
+++ b/sqlite_to_tabular.py	Mon Jul 17 15:22:04 2017 -0400
@@ -31,8 +31,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
 
@@ -48,16 +47,15 @@
     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))
         exit(0)
     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__":