From a5276b9056bedc1b78a6b809f68c9f77daf6ee3f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 3 Jul 2016 21:02:52 -0400 Subject: Fix StringIO python 3k compat --- steuermann/nodes.py | 6 +++++- steuermann/report.py | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/steuermann/nodes.py b/steuermann/nodes.py index aaf42d6..521db2d 100644 --- a/steuermann/nodes.py +++ b/steuermann/nodes.py @@ -237,7 +237,11 @@ class node(object) : # debug - make a string representation of all the nodes def show_nodes( node_index ) : - import cStringIO as StringIO + try: + from io import StringIO + except ImportError: + from cStringIO import StringIO + s = StringIO.StringIO() for x in sorted( [ x for x in node_index ] ) : x = node_index[x] diff --git a/steuermann/report.py b/steuermann/report.py index afdf650..f27d84d 100644 --- a/steuermann/report.py +++ b/steuermann/report.py @@ -11,7 +11,7 @@ import pandokia.common try: from io import StringIO except ImportError: - import StringIO + from StringIO import StringIO # maybe the output is html 3.2 - in any case, it is way simpler than # more recent standards. @@ -170,7 +170,7 @@ def report_text( db, run_name, info_callback = info_callback_status ) : raw = raw_report( db, run_name, info_callback ) - s = StringIO.StringIO() + s = StringIO() table_list = get_table_list(db, run_name) @@ -196,7 +196,7 @@ def report_text( db, run_name, info_callback = info_callback_status ) : def report_html( db, run_name, info_callback = info_callback_status, hlevel=1 ) : raw = raw_report( db, run_name, info_callback ) - s = StringIO.StringIO() + s = StringIO() s.write('%s\n'%(hlevel,run_name,hlevel)) hlevel = hlevel + 1 -- cgit