diff options
-rw-r--r-- | qutebrowser/misc/earlyinit.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index e8040c670..36d61e53d 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -29,6 +29,7 @@ try: except ImportError: hunter = None +import os import sys import faulthandler import traceback @@ -130,6 +131,18 @@ def init_faulthandler(fileobj=sys.__stderr__): # pylint: enable=no-member,useless-suppression +def pyinstaller_qt_workaround(): + """Work around PATH issues with PyInstaller. + + See https://github.com/pyinstaller/pyinstaller/issues/4293 + and https://github.com/gridsync/gridsync/pull/236/commits/0abf8e7363cc8c2a10a0263e6dcceb3be1c07022 + """ + if (hasattr(sys, 'frozen') and + hasattr(sys, '_MEIPASS') and + sys.platform == 'win32'): + os.environ['PATH'] += os.pathsep + sys._MEIPASS + + def check_pyqt_core(): """Check if PyQt core is installed.""" try: @@ -288,6 +301,7 @@ def early_init(args): init_faulthandler() # Here we check if QtCore is available, and if not, print a message to the # console or via Tk. + pyinstaller_qt_workaround() check_pyqt_core() # Init logging as early as possible init_log(args) |