From b8546fabf998319bd13b9f89bf93ff1384c5ef8b Mon Sep 17 00:00:00 2001 From: Jylpah Date: Tue, 17 Dec 2019 21:25:54 +0200 Subject: [PATCH] do chdir() to read config files correctly --- extractTankopedia.py | 4 +++- getTankopedia.py | 2 ++ wotbreplay_uploader.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/extractTankopedia.py b/extractTankopedia.py index 55f29de..f1fc4b0 100644 --- a/extractTankopedia.py +++ b/extractTankopedia.py @@ -17,7 +17,9 @@ wg = None ## main() ------------------------------------------------------------- async def main(argv): global wg - + # set the directory for the script + os.chdir(os.path.dirname(sys.argv[0])) + parser = argparse.ArgumentParser(description='Extract Tankopedia data from Blitz game files') parser.add_argument('blitzAppBase', type=str, metavar="BLITZAPP_FOLDER", default=".", help='Base dir of the Blitz App files') parser.add_argument('tanks', type=str, default='tanks.json', nargs='?', metavar="TANKS_FILE", help='File to write Tankopedia') diff --git a/getTankopedia.py b/getTankopedia.py index 7e3d24d..05f08d0 100644 --- a/getTankopedia.py +++ b/getTankopedia.py @@ -49,6 +49,8 @@ async def get_tankopedia(filename: str): def main(argv): global VERBOSE, DEBUG + # set the directory for the script + os.chdir(os.path.dirname(sys.argv[0])) parser = argparse.ArgumentParser(description='Retrieve Tankopedia from WoTinspector.com') parser.add_argument('--file', dest="outfile", help='Write Tankopedia to file') diff --git a/wotbreplay_uploader.py b/wotbreplay_uploader.py index dae421e..043b2d6 100644 --- a/wotbreplay_uploader.py +++ b/wotbreplay_uploader.py @@ -25,6 +25,8 @@ wi = None async def main(argv): global wg, wi + # set the directory for the script + os.chdir(os.path.dirname(sys.argv[0])) ## Read config config = configparser.ConfigParser()