From 11275651a260fac79922c9b7d8d7d890649337c2 Mon Sep 17 00:00:00 2001 From: gryf Date: Sun, 6 Sep 2020 18:26:57 +0200 Subject: [PATCH] Fix flake8 issues in ui module. --- ebook_converter/customize/ui.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ebook_converter/customize/ui.py b/ebook_converter/customize/ui.py index 393e595..151c7c9 100644 --- a/ebook_converter/customize/ui.py +++ b/ebook_converter/customize/ui.py @@ -96,13 +96,16 @@ def _run_filetype_plugins(path_to_file, ft=None, occasion='preprocess'): pass try: nfp = plugin.run(nfp) or nfp - except: + except Exception: print('Running file type plugin %s failed with traceback:' % plugin.name, file=oe) traceback.print_exc(file=oe) sys.stdout, sys.stderr = oo, oe - x = lambda j: os.path.normpath(os.path.normcase(j)) - if occasion == 'postprocess' and x(nfp) != x(path_to_file): + + def norm(string): + return os.path.normpath(os.path.normcase(string)) + + if occasion == 'postprocess' and norm(nfp) != norm(path_to_file): shutil.copyfile(nfp, path_to_file) nfp = path_to_file return nfp