Add helper function to identify when app running as pyinstaller app

Useful for when want the app to behave differently in pyinstaller app
scenario with frozen python. And in development scenarios
This commit is contained in:
Debanjum Singh Solanky
2022-08-18 23:17:21 +03:00
parent 6c5c1c33c1
commit ffbf15eff8
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
# Standard Packages
import pathlib
import sys
from os.path import join
@@ -54,4 +55,9 @@ def load_model(model_name, model_dir, model_type):
if model_path is not None:
model.save(model_path)
return model
return model
def is_pyinstaller_app():
"Returns true if the app is running from Native GUI created by PyInstaller"
return getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS')