mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
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:
@@ -3,7 +3,7 @@ import argparse
|
||||
import pathlib
|
||||
|
||||
# Internal Packages
|
||||
from src.utils.helpers import get_absolute_path, resolve_absolute_path
|
||||
from src.utils.helpers import resolve_absolute_path
|
||||
from src.utils.yaml import parse_config_from_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')
|
||||
Reference in New Issue
Block a user