From 3bcd2b61738f6de4b1e42f3c4af8da266267d3f3 Mon Sep 17 00:00:00 2001 From: Godzil Date: Mon, 7 Oct 2019 17:58:32 +0100 Subject: [PATCH] Print a nice banner and handle some errors in a more friendly way. --- splashbuilder.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/splashbuilder.py b/splashbuilder.py index 7ee41b4..be6910f 100644 --- a/splashbuilder.py +++ b/splashbuilder.py @@ -321,6 +321,8 @@ class BootSplash(object): def main(): + print("WonderSwan SplashBuilder v") + parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", required=True, type=str, help="Configuration file") parser.add_argument("-o", "--output", type=str, help="Output file", default="output.bin") @@ -333,8 +335,14 @@ def main(): print("Error: config file '{f}' not found".format(f=args.config)) return -1 - bs = BootSplash(config) - bs.write(args.output) + try: + bs = BootSplash(config) + bs.write(args.output) + except FileNotFoundError as e: + print("Error: The file '{f}' cannot be found," + " please check your config file".format(f=e.filename)) + except Exception as e: + print("Error: {e}".format(e=e)) if __name__ == "__main__":