diff options
Diffstat (limited to 'wikicvt.py')
-rwxr-xr-x | wikicvt.py | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -15,9 +15,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +from __future__ import print_function import sys import getopt -import StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO from wiki2html import * from wiki2text import * from wiki2texi import * @@ -25,17 +29,17 @@ from wiki2texi import * class DumpWikiMarkup (WikiMarkup): def __str__(self): if self.tree: - s = StringIO.StringIO() + s = StringIO() self.dump(self.tree, 0, s) return s.getvalue() else: return "" def usage(code=0): - print """ -usage: %s [-hvt] [-I INTYPE] [-l lang] [-o kw=val] [--lang=lang] [--option kw=val] - [--input-type=INTYPE] [--type=OUTTYPE] [--help] [--verbose] file -""" % (sys.argv[0]) + print("""usage: %s [-hvt] [-I INTYPE] [-l lang] [-o kw=val] [--lang=lang] + [--option kw=val] [--input-type=INTYPE] [--type=OUTTYPE] [--help] + [--verbose] file +""" % sys.argv[0]) sys.exit(code) handlers = { @@ -109,12 +113,12 @@ def main(): markup = handlers[otype][itype](**kwdict) markup.debug_level = debug markup.parse() - print str(markup) + print("%s" % str(markup)) exit(0) else: - print "unsupported input type: %s" % (itype) + print("unsupported input type: %s" % itype) else: - print "unsupported output type: %s" % (otype) + print("unsupported output type: %s" % otype) exit(1) if __name__ == '__main__': |