Skip to content

Commit

Permalink
Replace interactive exit by sys.exit (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristofKaufmann authored Dec 4, 2023
1 parent 9fd31e0 commit 4f8dc46
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/python/scripts/import_roms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import pathlib
import shutil
import sys
import warnings
from typing import Optional

Expand Down Expand Up @@ -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)
Expand All @@ -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(
Expand Down

0 comments on commit 4f8dc46

Please sign in to comment.