[Python-Dev] Symbolic errno values in error messages (original) (raw)

Jean-Paul Calderone exarkun at divmod.com
Fri May 16 16:38:56 CEST 2008


On Sat, 17 May 2008 00:15:23 +1000, Nick Coghlan <ncoghlan at gmail.com> wrote:

Alexander Belopolsky wrote:

Yannick Gingras <ygingras ygingras.net> writes:

2) Where can I find the symbolic name in C?

Use standard C library char* strerror(int errnum) function. You can see an example usage in Modules/posixmodule.c (posixstrerror). I don't believe that would provide adequate Windows support.

It's not C, but maybe it's interesting to look at anyway:

http://twistedmatrix.com/trac/browser/trunk/twisted/python/win32.py?rev=21682#L94

However, neither strerror nor the linked code gives out symbolic names for errnos. They both produce messages like "Interrupted system call", whereas the symbolic name would be "EINTR". Modules/errnomodule.c might be worth looking at, although its solution is somewhat disappointing.

Jean-Paul



More information about the Python-Dev mailing list