From a6edb9a59ca7b69cf9fea0ada1ddd51ad23b188e Mon Sep 17 00:00:00 2001 From: Simon Hancock Date: Sun, 17 Mar 2024 13:18:49 +0000 Subject: [PATCH] mavlogdump: Use sys.exit instead of quit on error --- tools/mavlogdump.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/mavlogdump.py b/tools/mavlogdump.py index 55412ce04..8ae3742d6 100755 --- a/tools/mavlogdump.py +++ b/tools/mavlogdump.py @@ -79,7 +79,7 @@ # Check that the mat_file argument has been specified if args.mat_file is None: print("mat_file argument must be specified when mat format is selected") - quit() + sys.exit(1) # Load these modules here, as they're only needed for MAT file creation import scipy.io import numpy as np @@ -190,13 +190,13 @@ def match_type(mtype, patterns): offsets[type] = currentOffset currentOffset += len(fields) except IndexError: - quit() + sys.exit(1) except AttributeError: print("Message type '%s' not found" % (type)) - quit() + sys.exit(1) except TypeError: print("You must specify a list of message types if outputting CSV format via the --types argument.") - exit() + sys.exit(1) # The first line output are names for all columns print(args.csv_sep.join(fields)) @@ -204,7 +204,7 @@ def match_type(mtype, patterns): if (isbin or islog) and args.format == 'csv': # need to accumulate columns from message if types is None or len(types) != 1: print("Need exactly one type when dumping CSV from bin file") - quit() + sys.exit(1) # Track types found available_types = set() @@ -224,7 +224,7 @@ def match_type(mtype, patterns): # Make sure the specified type was found if match_types is None: print("Specified type '%s' not found in log file" % (types[0])) - quit() + sys.exit(1) # we need FMT messages for column headings match_types.append("FMT")