From 1da3b57f5ae7a4302fb720d9b8e2a3aae4710cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=AA=8E?= Date: Sun, 5 Mar 2017 19:23:49 +0800 Subject: [PATCH] no need future module for python2 fix missing StringIO --- cps/fb2.py | 6 ++++-- cps/ub.py | 2 +- cps/web.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cps/fb2.py b/cps/fb2.py index c68fc380..aa004b10 100644 --- a/cps/fb2.py +++ b/cps/fb2.py @@ -4,8 +4,10 @@ from lxml import etree import os import uploader -import StringIO - +try: + import StringIO +except: + from io import StringIO def get_fb2_info(tmp_file_path, original_file_extension): diff --git a/cps/ub.py b/cps/ub.py index 659106cb..8b52cc1b 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -10,7 +10,7 @@ import os import logging from werkzeug.security import generate_password_hash from flask_babel import gettext as _ -from builtins import str +#from builtins import str dbpath = os.path.join(os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + os.sep + ".." + os.sep), "app.db") engine = create_engine('sqlite:///{0}'.format(dbpath), echo=False) diff --git a/cps/web.py b/cps/web.py index 32698f01..3b3da474 100755 --- a/cps/web.py +++ b/cps/web.py @@ -47,7 +47,7 @@ import db from shutil import move, copyfile from tornado.ioloop import IOLoop from tornado import version as tornadoVersion -from builtins import str +#from builtins import str try: from urllib.parse import quote