diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index 3b8f3c915fce5b9e5fc30708d3235ca9123685e2..346070be5cfc6a567f58a5df8923d9817700bfba 100644
--- a/geomagio/Controller.py
+++ b/geomagio/Controller.py
@@ -362,7 +362,7 @@ def get_output_factory(args):
         try:
             # python 3
             output_stream = sys.stdout.buffer
-        except:
+        except AttributeError:
             # python 2
             output_stream = sys.stdout
     elif args.output_url is not None:
diff --git a/test/TimeseriesUtility_test.py b/test/TimeseriesUtility_test.py
index e654eec0365f6f85c5913c00c9d469544649987c..8f11588059c1fe709fd4283e015a170fa05a2349 100644
--- a/test/TimeseriesUtility_test.py
+++ b/test/TimeseriesUtility_test.py
@@ -36,6 +36,7 @@ def test_get_stream_gaps():
     # no gaps in Z channel
     assert_equals(len(gaps['Z']), 0)
 
+
 def test_get_stream_gaps_channels():
     """TimeseriesUtility_test.test_get_stream_gaps_channels()
 
@@ -56,6 +57,7 @@ def test_get_stream_gaps_channels():
     assert_equals('H' in gaps, False)
     assert_equals(len(gaps['Z']), 0)
 
+
 def test_get_trace_gaps():
     """TimeseriesUtility_test.test_get_trace_gaps()