diff --git a/src/scott/scott.py b/src/scott/scott.py index 1452a9b..d9555e2 100644 --- a/src/scott/scott.py +++ b/src/scott/scott.py @@ -28,8 +28,6 @@ The application entry point is responsible for defining the command names. Once invalid input, and invokes the selected module's ``scott_run(args)`` function. """ -sys.dont_write_bytecode = True - class Scott: """ @@ -71,7 +69,7 @@ class Scott: scott_run = getattr(module, "scott_run", None) if not callable(scott_run): print( - f"Warning: Script {cmd_name}.py is missing a scott_run() function, skipping registration.", + f"Warning: ({cmd_name}) missing a scott_run() function, skipping registration.", file=sys.stderr, ) return @@ -81,7 +79,7 @@ class Scott: parameter_count = 0 if parameter_count != 1: print( - f"Warning: Script {cmd_name}.py scott_run() must take exactly one argument, skipping registration.", + f"Warning: ({cmd_name}) scott_run() must take exactly one argument, skipping registration.", file=sys.stderr, ) return @@ -93,13 +91,14 @@ class Scott: subparser = self.subparsers.add_parser( cmd_name, help = module.scott_description() if hasattr(module, "scott_description") else None, + formatter_class=argparse.RawTextHelpFormatter ) self.subparsers_by_command[cmd_name] = subparser if hasattr(module, "scott_arguments"): module.scott_arguments(subparser) - except ModuleNotFoundError: + except ModuleNotFoundError as error: print( - f"Warning: Script {cmd_name}.py not found, skipping registration.", + f"Warning: ({cmd_name}) Error loading command script\n{error}\nskipping registration.", file=sys.stderr, )