redhongx

【app.py】修正调度器bug

Showing 1 changed file with 4 additions and 4 deletions
@@ -44,15 +44,15 @@ def run_script(): @@ -44,15 +44,15 @@ def run_script():
44 for script_name, script_path in scripts: 44 for script_name, script_path in scripts:
45 try: 45 try:
46 print(f"Running {script_name}...") 46 print(f"Running {script_name}...")
47 - result = subprocess.run(['python', script_path], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)  
48 - print(f"{script_name} finished successfully. Output:\n{result.stdout.decode()}") 47 + subprocess.run(['python', script_path], check=True)
  48 + print(f"{script_name} finished successfully.")
49 except subprocess.CalledProcessError as e: 49 except subprocess.CalledProcessError as e:
50 - print(f"An error occurred while running {script_name}: {e.stderr.decode()}") 50 + print(f"An error occurred while running {script_name}: {e}")
51 51
52 52
53 if __name__ == '__main__': 53 if __name__ == '__main__':
54 scheduler = BackgroundScheduler(timezone=utc) 54 scheduler = BackgroundScheduler(timezone=utc)
55 - scheduler.add_job(run_script, 'interval', hours=5) 55 + scheduler.add_job(run_script, 'interval', minutes=1)
56 scheduler.start() 56 scheduler.start()
57 57
58 try: 58 try: