Skip to content

Fix except clause catching a ValueError instance instead of the type - #3405

Merged
C-Achard merged 1 commit into
DeepLabCut:external/hwang-misc-fixesfrom
Denny-Hwang:fix/except-valueerror-call
Jul 16, 2026
Merged

Fix except clause catching a ValueError instance instead of the type#3405
C-Achard merged 1 commit into
DeepLabCut:external/hwang-misc-fixesfrom
Denny-Hwang:fix/except-valueerror-call

Conversation

@Denny-Hwang

Copy link
Copy Markdown
Contributor

In extract_outlier_frames (outlieralgorithm='list'), the handler was written 'except ValueError():', which evaluates ValueError() to an instance. When the try body raised a ValueError, Python's exception matching hit a non-class handler and raised
'TypeError: catching classes that do not inherit from BaseException is not allowed', masking the real error and the intended message. Catch the ValueError type instead.

In extract_outlier_frames (outlieralgorithm='list'), the handler was
written 'except ValueError():', which evaluates ValueError() to an
instance. When the try body raised a ValueError, Python's exception
matching hit a non-class handler and raised
'TypeError: catching classes that do not inherit from BaseException
is not allowed', masking the real error and the intended message.
Catch the ValueError type instead.
@C-Achard C-Achard added the bug fix! fix for a real buggy one... label Jul 15, 2026
@C-Achard
C-Achard changed the base branch from main to external/hwang-misc-fixes July 16, 2026 07:22
@C-Achard
C-Achard merged commit c94fdd0 into DeepLabCut:external/hwang-misc-fixes Jul 16, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix! fix for a real buggy one...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants