Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mavlogdump: Use sys.exit instead of quit on error #930

Merged
merged 1 commit into from
Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading