diff filter_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/filter_tabular.py	Fri Jul 14 17:34:22 2017 -0400
+++ b/filter_tabular.py	Mon Jul 17 15:22:04 2017 -0400
@@ -29,8 +29,7 @@
             inputPath = os.path.abspath(options.input)
             inputFile = open(inputPath, 'r')
         except Exception as e:
-            print("failed: %s" % e, file=sys.stderr)
-            exit(3)
+            exit('Error: %s' % (e))
     else:
         inputFile = sys.stdin
 
@@ -39,8 +38,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
 
@@ -49,8 +47,8 @@
         try:
             fh = open(options.jsonfile)
             filters = json.load(fh)
-        except Exception as exc:
-            print("Error: %s" % exc, file=sys.stderr)
+        except Exception as e:
+            exit('Error: %s' % (e))
 
     if options.verbose and filters:
         for f in filters:
@@ -62,9 +60,8 @@
 
     try:
         filter_file(inputFile, outputFile, filters=filters)
-    except Exception as exc:
-        print("Error: %s" % exc, file=sys.stderr)
-        exit(1)
+    except Exception as e:
+        exit('Error: %s' % (e))
 
 
 if __name__ == "__main__":