diff -r 960850ec284c -r a22eee00b052 eric6/eric6.py --- a/eric6/eric6.py Sat Aug 31 12:29:57 2019 +0200 +++ b/eric6/eric6.py Sat Aug 31 12:58:11 2019 +0200 @@ -29,14 +29,6 @@ import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ -try: # Only for Py2 - import Globals.compatibility_fixes # __IGNORE_WARNING__ - import StringIO as io # __IGNORE_EXCEPTION__ - import locale -except ImportError: - import io # __IGNORE_WARNING__ - basestring = str - try: try: from PyQt5 import sip # __IGNORE_EXCEPTION__ @@ -49,17 +41,15 @@ import traceback import time import logging +import io try: from PyQt5.QtCore import qWarning, QLibraryInfo, QTimer, QCoreApplication except ImportError: - try: # Py2 - import tkMessageBox as messagebox + try: + from tkinter import messagebox except ImportError: - try: # Py3 - from tkinter import messagebox - except ImportError: - sys.exit(100) + sys.exit(100) messagebox.showerror( "eric6 Error", "PyQt could not be imported. Please make sure" @@ -194,15 +184,13 @@ if distroInfo: versionInfo += "{0}\n{1}".format(separator, distroInfo) - if isinstance(excType, basestring): + if isinstance(excType, str): tbinfo = tracebackobj else: tbinfofile = io.StringIO() traceback.print_tb(tracebackobj, None, tbinfofile) tbinfofile.seek(0) tbinfo = tbinfofile.read() - if sys.version_info[0] == 2: - tbinfo = tbinfo.decode(locale.getpreferredencoding()) errmsg = '{0}: \n{1}'.format(str(excType), str(excValue)) sections = [separator, timeString, separator, errmsg, separator, tbinfo] msg = '\n'.join(sections) @@ -215,10 +203,6 @@ pass if inMainLoop is None: - if sys.version_info[0] == 2: - notice = notice.encode(sys.stdout.encoding, 'replace') - msg = msg.encode(sys.stdout.encoding, 'replace') - versionInfo = versionInfo.encode(sys.stdout.encoding, 'replace') warning = notice + msg + versionInfo print(warning) # __IGNORE_WARNING_M801__ else: @@ -228,8 +212,6 @@ .replace("&", "&")\ .replace(">", ">")\ .replace("<", "<") - if sys.version_info[0] == 2: - warning = warning.encode('utf-8', 'replace') qWarning(warning) @@ -335,8 +317,6 @@ path = os.path.join(pyqtDataDir, "bin") else: path = pyqtDataDir - if sys.version_info[0] == 2: - path = path.encode(sys.getfilesystemencoding()) os.environ["PATH"] = path + os.pathsep + os.environ["PATH"] pluginFile = None