From bc790238cc63ed52353c621b6fd921d5a6957c28 Mon Sep 17 00:00:00 2001 From: gryf Date: Sat, 18 Jul 2020 19:38:57 +0200 Subject: [PATCH] Removed old py2 code from constants --- ebook_converter/constants_old.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/ebook_converter/constants_old.py b/ebook_converter/constants_old.py index a63c60e..fff0501 100644 --- a/ebook_converter/constants_old.py +++ b/ebook_converter/constants_old.py @@ -1,4 +1,3 @@ -import codecs import collections import importlib import locale @@ -11,32 +10,14 @@ numeric_version = (4, 12, 0) __version__ = '.'.join([str(x) for x in numeric_version]) __author__ = "foobar" -''' +""" Various run time constants. -''' +""" FAKE_PROTOCOL = 'ebco' -try: - preferred_encoding = locale.getpreferredencoding() - codecs.lookup(preferred_encoding) -except Exception: - preferred_encoding = 'utf-8' - - +preferred_encoding = locale.getpreferredencoding() filesystem_encoding = sys.getfilesystemencoding() or 'utf-8' -try: - if codecs.lookup(filesystem_encoding).name == 'ascii': - filesystem_encoding = 'utf-8' - # On linux, unicode arguments to os file functions are coerced to an - # ascii bytestring if sys.getfilesystemencoding() == 'ascii', which is - # just plain dumb. This is fixed by the icu.py module which, when - # imported changes ascii to utf-8 - # TODO(gryf): this is not true for py3 -except Exception: - filesystem_encoding = 'utf-8' - - DEBUG = os.getenv('CALIBRE_DEBUG') is not None