Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.0.0
Description
OSError is the builtin error type used for exceptions that relate to the operating system.
In Python 3.3, a variety of other exceptions, like WindowsError were aliased to OSError. These aliases remain in place for compatibility with older versions of Python, but may be removed in future versions.
Prefer using OSError directly, as it is more idiomatic and future-proof.
Example
raise IOError
Use instead:
raise OSError
https://docs.astral.sh/ruff/rules/os-error-alias/
https://docs.python.org/3/library/exceptions.html#OSError
Attachments
Issue Links
- links to