From 4f8dc4645ac5ecaf8711d54b22573ad4080f4c89 Mon Sep 17 00:00:00 2001 From: ChristofKaufmann Date: Mon, 4 Dec 2023 14:54:48 +0100 Subject: [PATCH] Replace interactive exit by sys.exit (#498) --- src/python/scripts/import_roms.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/python/scripts/import_roms.py b/src/python/scripts/import_roms.py index 7ed6c68ac..b8f9dc582 100644 --- a/src/python/scripts/import_roms.py +++ b/src/python/scripts/import_roms.py @@ -1,6 +1,7 @@ import argparse import pathlib import shutil +import sys import warnings from typing import Optional @@ -65,7 +66,7 @@ def main() -> None: if not romdir.exists(): print(f"Path {romdir} doesn't exist.") - exit(1) + sys.exit(1) elif args.import_from_pkg: if "." in args.import_from_pkg: root, subpackage = args.import_from_pkg.split(".", maxsplit=1) @@ -76,13 +77,13 @@ def main() -> None: romdir = path.resolve() if not romdir.exists(): print(f"Unable to find path {subpackage} in module {root}.") - exit(1) + sys.exit(1) except ModuleNotFoundError: print(f"Unable to find module {root}.") - exit(1) + sys.exit(1) except Exception as e: print(f"Unknown error {str(e)}.") - exit(1) + sys.exit(1) with warnings.catch_warnings(): warnings.filterwarnings(