try... except with unknown error types

John Nagle nagle at animats.com
Thu Sep 1 06:22:23 CEST 2011


On 8/21/2011 5:30 PM, Steven D'Aprano wrote:
> Chris Angelico wrote:
>
>
>> A new and surprising mode of network failure would be indicated by a
>> new subclass of IOError or EnvironmentError.
>
> /s/would/should/
>
> I don't see why you expect this, when *existing* network-related failures
> aren't:
>
>>>> import socket
>>>> issubclass(socket.error, EnvironmentError)
> False
>
> (Fortunately that specific example is fixed in Python 3.)

    I think I reported that some years ago.

    There were some other errors in the URL and SSL area that
weren't subclasses of EnvironmentError.  It's also possible
to get UnicodeError from URL operations.

					John Nagle



More information about the Python-list mailing list