diff --git a/src/prep.py b/src/prep.py index 468799ca4..87248664a 100644 --- a/src/prep.py +++ b/src/prep.py @@ -70,11 +70,15 @@ def __init__(self, screens, img_host, config): self.img_host = img_host.lower() tmdb.API_KEY = config['DEFAULT']['tmdb_api'] - async def prompt_user_for_confirmation(self, message): - response = input(f"{message} (Y/n): ").strip().lower() - if response == '' or response == 'y': - return True - return False + async def prompt_user_for_confirmation(self, message: str) -> bool: + try: + response = input(f"{message} (Y/n): ").strip().lower() + if response in ["y", "yes", ""]: + return True + return False + except EOFError: + console.print("[bold red]Input was interrupted.") + return False async def check_images_concurrently(self, imagelist): async def check_and_collect(image_dict): diff --git a/upload.py b/upload.py index e6630fc4a..5121aaf52 100644 --- a/upload.py +++ b/upload.py @@ -602,13 +602,11 @@ def get_missing(meta): if __name__ == '__main__': pyver = platform.python_version_tuple() - if int(pyver[0]) != 3: - console.print("[bold red]Python2 Detected, please use python3") - exit() - else: - if int(pyver[1]) <= 6: - console.print("[bold red]Python <= 3.6 Detected, please use Python >=3.7") - loop = asyncio.get_event_loop() - loop.run_until_complete(do_the_thing(base_dir)) - else: - asyncio.run(do_the_thing(base_dir)) + if int(pyver[0]) != 3 or int(pyver[1]) < 12: + console.print("[bold red]Python version is too low. Please use Python 3.12 or higher.") + sys.exit(1) + + try: + asyncio.run(do_the_thing(base_dir)) # Pass the correct base_dir value here + except (KeyboardInterrupt, SystemExit): + console.print("[bold red]Program interrupted. Exiting.")