From de15b4a9111db39e5fcc9cea2314881f1bb70eda Mon Sep 17 00:00:00 2001
From: Jeremy Fee <jmfee@usgs.gov>
Date: Fri, 2 Nov 2018 10:21:41 -0600
Subject: [PATCH] Fix linting errors

---
 geomagio/TimeseriesFactory.py         | 2 ++
 geomagio/WebService.py                | 3 +++
 geomagio/algorithm/SqDistAlgorithm.py | 4 ++--
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/geomagio/TimeseriesFactory.py b/geomagio/TimeseriesFactory.py
index 0096adeed..50adb2fd9 100644
--- a/geomagio/TimeseriesFactory.py
+++ b/geomagio/TimeseriesFactory.py
@@ -110,6 +110,8 @@ class TimeseriesFactory(object):
             try:
                 data = Util.read_url(url)
             except IOError as e:
+                print("Error reading url: %s, continuing" % str(e),
+                        file=sys.stderr)
                 continue
             try:
                 timeseries += self.parse_string(data,
diff --git a/geomagio/WebService.py b/geomagio/WebService.py
index e0e166105..e304ade08 100644
--- a/geomagio/WebService.py
+++ b/geomagio/WebService.py
@@ -6,6 +6,7 @@ from cgi import escape, parse_qs
 from collections import OrderedDict
 from datetime import datetime
 from json import dumps
+import sys
 
 from geomagio.edge import EdgeFactory
 from geomagio.iaga2002 import IAGA2002Writer
@@ -109,6 +110,8 @@ class WebService(object):
             if isinstance(timeseries_string, str):
                 timeseries_string = timeseries_string.encode('utf8')
         except Exception as e:
+            print("Error processing request: %s" % str(e),
+                    file=sys.stderr)
             message = "Server error."
             error_body = self.error(500, message, environ, start_response)
             return [error_body]
diff --git a/geomagio/algorithm/SqDistAlgorithm.py b/geomagio/algorithm/SqDistAlgorithm.py
index 69db1d913..3822a73c7 100644
--- a/geomagio/algorithm/SqDistAlgorithm.py
+++ b/geomagio/algorithm/SqDistAlgorithm.py
@@ -11,7 +11,7 @@
     Use of fmin_l_bfgs_b to estimate parameters inspired by Andre Queiroz:
         https://gist.github.com/andrequeiroz/5888967
 """
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 from .. import StreamConverter
 from .Algorithm import Algorithm
@@ -82,7 +82,7 @@ class SqDistAlgorithm(Algorithm):
             # state is up to date, only need new data
             return (start, end)
         # state not up to date, need to prime
-        print('WARNING: missing or incompatible state...' + \
+        print('WARNING: missing or incompatible state...' +
               'reinitializing.', file=sys.stderr)
         return (start - 3 * 30 * 24 * 60 * 60, end)
 
-- 
GitLab