From 0b8811784454c427016b198bf221374df8d2fc2f Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 2 Apr 2021 19:13:04 +0100 Subject: [PATCH] chdir() to __file__ when not running frozen --- EDMarketConnector.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 87bee355..3bf232f2 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -6,6 +6,7 @@ import argparse import html import json import locale +import pathlib import re import sys import webbrowser @@ -27,6 +28,11 @@ if getattr(sys, 'frozen', False): environ['TCL_LIBRARY'] = join(dirname(sys.path[0]), 'lib', 'tcl') environ['TK_LIBRARY'] = join(dirname(sys.path[0]), 'lib', 'tk') +else: + # We still want to *try* to have CWD be where the main script is, even if + # not frozen. + chdir(pathlib.Path(__file__).parent) + from constants import applongname, appname, protocolhandler_redirect # config will now cause an appname logger to be set up, so we need the