From 6eed2161e3fc4713f2e9fde04da4a1e75a585c93 Mon Sep 17 00:00:00 2001 From: RaresCode Date: Mon, 23 Sep 2024 20:28:07 +0300 Subject: [PATCH] Update script_runner.py --- sites/script_runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sites/script_runner.py b/sites/script_runner.py index cfb82ee..230dead 100644 --- a/sites/script_runner.py +++ b/sites/script_runner.py @@ -18,11 +18,11 @@ def run(self): # Iterate over all files in the 'sites' directory for site in os.listdir(path): if site.endswith('.py') and site not in self.exclude: - script_path = os.path.join(path, site) # Full path to the script + script_path = os.path.join(path, site) try: print(f"Running: python3 {script_path}") - # Run the script with 'python3' and capture the output - result = subprocess.run(['python3', script_path], cwd=path, check=True) + # Run the script with 'python3' using shell=True to simulate direct execution + result = subprocess.run(f'python3 {script_path}', cwd=path, shell=True, check=True, env=os.environ) print(f"Success scraping {site} with exit code {result.returncode}") except subprocess.CalledProcessError as e: print(f"Error scraping {site} with exit code {e.returncode}: {e}") @@ -30,6 +30,7 @@ def run(self): print(f"An unexpected error occurred while scraping {site}: {e}") + if __name__ == "__main__": # exclude files exclude = [