Skip to content
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
11 changes: 3 additions & 8 deletions Examples/analysis_default_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,15 @@ def main(args):
args = parser.parse_args()

# set args.format automatically
args.format = None # default
try:
yt.load(args.path)
args.format = "plotfile"
except Exception:
try:
OpenPMDTimeSeries(args.path)
except Exception:
pass # neither format matched
else:
args.format = "openpmd"
else:
args.format = "plotfile"
if args.format is None:
raise ValueError(f"Could not detect format for path: {args.path}")
except Exception:
raise ValueError(f"Could not detect format for path: {args.path}") from None
Copy link
Copy Markdown
Member

@ax3l ax3l Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, just learned about from None to suppress the context of the error raised.

Avoids: "During handling of the above exception, another exception occurred" verbosity


# set args.do_fields (not parsed, based on args.skip_fields)
args.do_fields = False if args.skip_fields else True
Expand Down
Loading