WindowsError is not available on linux?

Christian Heimes lists at cheimes.de
Wed Nov 18 22:09:20 CET 2009


Dave Angel wrote:
> Worse, even if the exception cannot be thrown on a non-Windows 
> environment, leaving it undefined makes it very awkward to write 
> portable code.  An except clause that can never happen in a particular 
> environment is pretty innocent.  Or somebody can use a base class for 
> his except clause, to catch this error and other related ones.  But it 
> blows up if you explicitly use this exception.  I think that needs 
> documentation, at a minimum.

WindowsError is a subclass of OSError that contains additional Windows
specific error information. Just catch OSError and you are on the safe
side.

Christian




More information about the Python-list mailing list