os-error-alias
What it does
Section titled “What it does”Reports EnvironmentError, IOError, WindowsError, mmap.error, os.error, select.error or socket.error in an except clause or a raise.
Why it matters
Section titled “Why it matters”Since Python 3.3 these names are other names of OSError. Using the old ones makes a reader look for a difference that is not there.
To fix, write OSError.
Example
Section titled “Example”...
try: passexcept IOError: passexcept (EnvironmentError, ValueError, socket.error): passexcept select.error: passraise IOError("x")...Configuration
Section titled “Configuration”python: lint: rules: os-error-alias: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line os-error-alias in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | UP024 |
full |