gh-37070: use directly OSError everywhere
fixed by `ruff --fix --select=UP024 src/`
OSError has replaced several errors since python 3.3:
https://stackoverflow.com/questions/29347790/difference-between-ioerror-
and-oserror
https://peps.python.org/pep-3151/#confusing-set-of-os-related-exceptions
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
URL: https://github.com/sagemath/sage/pull/37070
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert