Summary
In DataFileClass.run() (DataFileClass.py ~line 2265), the exception handlers are ordered incorrectly.
The block except Exception as ex: appears before the more specific exception handlers except (IOError, IndexError) and except OSError.
Since Exception is the superclass of these exceptions, it catches them first. As a result, the later handlers are unreachable and effectively dead code.
Expected behavior
Specific exceptions should be handled before the generic Exception handler so that they are reachable.
Correct order example:
try:
except (IOError, IndexError):
raise IndexError
except OSError:
raise OSError
except Exception as ex:
print(ex)
raise
Reproduction steps
- Open the repository.
- Navigate to DataFileClass.py.
- Locate the run() method around line ~2265.
- Observe the exception handling block where
except Exception as ex appears before specific exceptions.
- Because Exception is a superclass, the later handlers for (IOError, IndexError) and OSError will never execute.
Environment
OS: Windows 11
Python version: Python 3.13.9
Shell: Windows PowerShell
Environment: Conda base environment
Branch: main (or latest development branch)
Logs or screenshots
No response
Related work checked
Searched existing issues for "exception order", "dead exception handler", and "unreachable except block" but did not find an existing report.
Proposed track
None
Summary
In DataFileClass.run() (DataFileClass.py ~line 2265), the exception handlers are ordered incorrectly.
The block
except Exception as ex:appears before the more specific exception handlersexcept (IOError, IndexError)andexcept OSError.Since
Exceptionis the superclass of these exceptions, it catches them first. As a result, the later handlers are unreachable and effectively dead code.Expected behavior
Specific exceptions should be handled before the generic Exception handler so that they are reachable.
Correct order example:
try:
Reproduction steps
except Exception as exappears before specific exceptions.Environment
OS: Windows 11
Python version: Python 3.13.9
Shell: Windows PowerShell
Environment: Conda base environment
Branch: main (or latest development branch)
Logs or screenshots
No response
Related work checked
Searched existing issues for "exception order", "dead exception handler", and "unreachable except block" but did not find an existing report.
Proposed track
None