Skip to content

Commit

Permalink
mavlogdump: Use sys.exit instead of quit on error
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 authored and peterbarker committed Mar 17, 2024
1 parent 636a733 commit 5cedc2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/mavlogdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -190,21 +190,21 @@ 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))

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

Expand Down

0 comments on commit 5cedc2e

Please sign in to comment.