From bf15c8ff88326f57fdbb125be977d2764f9d35d4 Mon Sep 17 00:00:00 2001
From: Jeremy Fee <jmfee@usgs.gov>
Date: Wed, 27 Jun 2018 11:10:24 -0600
Subject: [PATCH] Use stdout.buffer in python 3

---
 geomagio/Controller.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index 79d7f085..3b8f3c91 100644
--- a/geomagio/Controller.py
+++ b/geomagio/Controller.py
@@ -359,7 +359,12 @@ def get_output_factory(args):
     if args.output_file is not None:
         output_stream = open(args.output_file, 'wb')
     elif args.output_stdout:
-        output_stream = sys.stdout
+        try:
+            # python 3
+            output_stream = sys.stdout.buffer
+        except:
+            # python 2
+            output_stream = sys.stdout
     elif args.output_url is not None:
         output_url = args.output_url
         output_factory_args['urlInterval'] = args.output_url_interval
-- 
GitLab