Python error codes and messages location

Cameron Simpson cs at zip.com.au
Sun May 26 22:02:41 EDT 2013


On 27May2013 00:53, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
| On Mon, 27 May 2013 02:13:54 +0300, Carlos Nepomuceno wrote:
| > Where can I find all error codes and messages that Python throws (actual
| > codes and messages from exceptions raised by stdlib)?
| 
| There is no list. It is subject to change from version to version, 
| including point releases.

And better still, it is platform specific too.

[...]
| > I've already found the module 'errno' and got a dictionary
| > (errno.errorcode) and some system error messages
| > (os.strerror(errno.ENAMETOOLONG)) but there's more I couldn't find.
| 
| These are the standard C operating system and file system error codes, 
| not Python exceptions.

And the poster boy example for platform dependence.

Besides, knowing the exact errors that may occur is not the Python Way, it is
the Java Way.

Run it. if it goes bang, handle the errors you expect and understand.
If you get something else, go bang for real because you _don't_
know what should happen, and proceeding is probably insane.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

Motorcycles are like peanuts... who can stop at just one?
- Zebee Johnstone <zebee at zip.com.au> aus.motorcycles Poser Permit #1



More information about the Python-list mailing list