From c367056e5bb75bfd9ce097af4eed24b08be05b9b Mon Sep 17 00:00:00 2001 From: Mohamed Feddad Date: Fri, 10 Jul 2020 00:20:43 +0300 Subject: [PATCH] Fix MacOs exe base directory. Resolves #186 --- app/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/utils.py b/app/utils.py index ea1243b..0a6df47 100644 --- a/app/utils.py +++ b/app/utils.py @@ -1,4 +1,5 @@ import os +import sys from collections import namedtuple from uuid import uuid4 from traceback import TracebackException @@ -63,8 +64,9 @@ def absolute_path(relative_path): Absolute path from `relative_path` ''' delimiter = '\\' if os.name == 'nt' else '/' - base_path = os.path.abspath('.') clean_path = relative_path + base_path = os.path.dirname(sys.executable)\ + if getattr(sys, 'frozen', False) else os.path.abspath('.') if clean_path.startswith(delimiter): clean_path = clean_path[len(delimiter):]