diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 32e87cb899..068f47fbd8 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1282,10 +1282,11 @@ def ensure_app(headless=True): with _ea_lock: if _store_app is None and QApplication.instance() is None: args = sys.argv[:1] - if headless and (islinux or isbsd): + has_headless = islinux or isbsd + if headless and has_headless: args += ['-platformpluginpath', sys.extensions_location, '-platform', 'headless'] _store_app = QApplication(args) - if headless and (islinux or isbsd): + if headless and has_headless: _store_app.headless = True import traceback # This is needed because as of PyQt 5.4 if sys.execpthook ==