PyInstaller recommends checking both the frozen and _MEIPASS attributes

This commit is contained in:
Philipp Wolfer
2023-06-11 00:57:17 +02:00
parent 1dfcd9e6e6
commit ab99fafd2e
2 changed files with 2 additions and 2 deletions

View File

@@ -30,5 +30,5 @@ IS_HAIKU = sys.platform == 'haiku1'
# These variables are set by pyinstaller if running from a packaged build
# See http://pyinstaller.readthedocs.io/en/stable/runtime-information.html
IS_FROZEN = getattr(sys, 'frozen', False)
IS_FROZEN = getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS')
FROZEN_TEMP_PATH = getattr(sys, '_MEIPASS', '')

View File

@@ -7,7 +7,7 @@ import sys
sys.path.insert(0, '.')
# This is needed to find resources when using pyinstaller
if getattr(sys, 'frozen', False):
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
basedir = getattr(sys, '_MEIPASS', '')
else:
basedir = os.path.dirname(os.path.abspath(__file__))