try... except with unknown error types

Stefan Krah stefan-usenet at
Fri Sep 9 23:41:18 CEST 2011

Chris Torek <nospam at> wrote:
> (I have also never been sure whether something is going to raise
> an IOError or an OSError for various OS-related read or write
> operation failures -- such as exceeding a resource limit, for
> instance -- so most places that do I/O operations on OS files, I
> catch both.  Still, it sure would be nice to have a static analysis
> tool that could answer questions about potential exceptions. :-) )

There is an effort to fix this:

And an implementation ...

... together with a feature request:

I think the whole concept makes a lot of sense and is really worth
taking a look at.

Stefan Krah

More information about the Python-list mailing list