From 9e625c4821f4c63421b3d3747c0c4f358fef6c5f Mon Sep 17 00:00:00 2001 From: Douglas Anderson <danderson@ntia.doc.gov> Date: Sun, 12 Feb 2017 15:52:19 -0800 Subject: python3: update non-GRC components to use python2 or python3 --- docs/doxygen/swig_doc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docs/doxygen/swig_doc.py') diff --git a/docs/doxygen/swig_doc.py b/docs/doxygen/swig_doc.py index c9e89aec1b..307920d776 100644 --- a/docs/doxygen/swig_doc.py +++ b/docs/doxygen/swig_doc.py @@ -26,6 +26,7 @@ The file instructs SWIG to transfer the doxygen comments into the python docstrings. """ +from __future__ import unicode_literals import sys, time @@ -84,8 +85,8 @@ def utoascii(text): if text is None: return '' out = text.encode('ascii', 'replace') - out = out.replace('"', '\\"') - return out + out = out.replace(b'"', b'\\"').decode('ascii') + return str(out) def combine_descriptions(obj): @@ -301,7 +302,7 @@ def make_swig_interface_file(di, swigdocfilename, custom_output=None): output = "\n\n".join(output) - swig_doc = file(swigdocfilename, 'w') + swig_doc = open(swigdocfilename, 'w') swig_doc.write(output) swig_doc.close() @@ -309,7 +310,7 @@ if __name__ == "__main__": # Parse command line options and set up doxyxml. err_msg = "Execute using: python swig_doc.py xml_path outputfilename" if len(sys.argv) != 3: - raise StandardError(err_msg) + raise Exception(err_msg) xml_path = sys.argv[1] swigdocfilename = sys.argv[2] di = DoxyIndex(xml_path) -- cgit v1.2.3