From f37f94547f2da3e0f79a82718f4fc1cce1d8e0fe Mon Sep 17 00:00:00 2001 From: iiPython Date: Sat, 14 Jan 2023 22:07:21 -0600 Subject: [PATCH] Make launch pyinstaller compatible --- launch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/launch.py b/launch.py index b6e9952..b04c94f 100644 --- a/launch.py +++ b/launch.py @@ -2,13 +2,15 @@ # Modules import os +import sys import json from flask import Flask # Initialization -config_file = os.path.join(os.path.dirname(__file__), "config.json") +tdir = os.path.dirname(__file__ if not getattr(sys, "frozen", False) else sys.executable) +config_file = os.path.join(tdir, "config.json") if not os.path.isfile(config_file): - exit("Missing configuration file!") + sys.exit("Missing configuration file!") with open(config_file, "r") as fh: data = json.loads(fh.read())