From abcdb53b0edb63f9a1de98d8a08bbf8ef157b545 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 30 Oct 2020 12:57:27 +0530 Subject: [PATCH] Fix calibre 5.4 not running via Launch Services on macOS --- bypy/macos/site.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bypy/macos/site.py b/bypy/macos/site.py index ecc8f0463d..73fa25eee6 100644 --- a/bypy/macos/site.py +++ b/bypy/macos/site.py @@ -48,12 +48,14 @@ def main(): set_helper() set_quit() + mod = __import__(sys.calibre_module, fromlist=[1]) + func = getattr(mod, sys.calibre_function) if sys.gui_app and not ( sys.stdout.isatty() or sys.stderr.isatty() or sys.stdin.isatty() ): + # this has to be done after calibre is imported and therefore + # calibre_extensions is available. nuke_stdout() - mod = __import__(sys.calibre_module, fromlist=[1]) - func = getattr(mod, sys.calibre_function) return func()