diff --git a/src/calibre/ebooks/metadata/sources/cli.py b/src/calibre/ebooks/metadata/sources/cli.py index d7d5153cf9..61b250e1db 100644 --- a/src/calibre/ebooks/metadata/sources/cli.py +++ b/src/calibre/ebooks/metadata/sources/cli.py @@ -21,6 +21,7 @@ from calibre.ebooks.metadata.sources.base import create_log from calibre.ebooks.metadata.sources.identify import identify from calibre.ebooks.metadata.sources.covers import download_cover from calibre.ebooks.metadata.sources.update import patch_plugins +from polyglot.builtins import unicode_type def option_parser(): @@ -99,7 +100,7 @@ def main(args=sys.argv): log = buf.getvalue() result = (metadata_to_opf(result) if opts.opf else - type(u'')(result).encode('utf-8')) + unicode_type(result).encode('utf-8')) if opts.verbose: print (log, file=sys.stderr) diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 5fc4a5bfb0..44cdba029b 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -27,6 +27,7 @@ from calibre.utils.html2text import html2text from calibre.utils.icu import lower from calibre.utils.date import UNDEFINED_DATE from calibre.utils.formatter import EvalFormatter +from polyglot.builtins import unicode_type # Download worker {{{ @@ -471,7 +472,7 @@ def identify(log, abort, # {{{ for r in presults: log('\n\n---') try: - log(type(u'')(r)) + log(unicode_type(r)) except TypeError: log(repr(r)) if plog: