From b062a8b65f1a333e1a1b86831f7ea952836fa44c Mon Sep 17 00:00:00 2001 From: Omar AbdElkareem Date: Sun, 1 Aug 2021 00:42:27 +0200 Subject: [PATCH] 3.4 --- plotter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plotter.py b/plotter.py index d1d6f80..27fd40b 100644 --- a/plotter.py +++ b/plotter.py @@ -76,8 +76,12 @@ def run(self): sess = requests.session() folder_name = datetime.now().strftime("%Y-%m-%d at %I.%M.%S %p") - script_path = os.path.abspath(__file__) - print(f"script abs path: {script_path}") + if getattr(sys, 'frozen', False) : + script_path = os.path.abspath(sys.executable) + print(f"script abs path (from executable): {script_path}") + else: + script_path = os.path.abspath(__file__) + print(f"script abs path (from script): {script_path}") cur_dir = os.path.dirname(script_path) # os.getcwd() print(f"current directory is {cur_dir}")