From 42ba2be0f873b0c0f651fb0b00454ee2dc2e555d Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Wed, 31 Jul 2024 20:08:30 -0300 Subject: [PATCH] Need to check if env file exists, otherwise it errors --- download.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/download.py b/download.py index 2389716..ab3fb88 100644 --- a/download.py +++ b/download.py @@ -18,13 +18,14 @@ if not DOWNLOAD_PATH: DOWNLOAD_PATH = "./downloads" # Read in dot env file -file = open(".env", "r") -lines = file.readlines() -for line in lines: - key, value = line.split("=") - key = key.strip() - if os.environ.get(key) is None: - os.environ[key] = value.strip() +if os.path.exists(".env"): + file = open(".env", "r") + lines = file.readlines() + for line in lines: + key, value = line.split("=") + key = key.strip() + if os.environ.get(key) is None: + os.environ[key] = value.strip() # Docs: https://app.swaggerhub.com/apis-docs/NexusMods/nexus-mods_public_api_params_in_form_data/1.0