[IronPython] _WindowsError and errno

Dino Viehland dinov at microsoft.com
Thu Nov 6 01:50:36 CET 2008

It's because when I initially looked at WindowsError it sure seemed like 22 was the error code that was always used :).  If you do:

for i in xrange(100):
    print WindowsError(i, i).errno

on CPython You'll see a large amount of the errno's are set to 22 (including 0 and 1) - apparently I didn't test enough combinations initially :(  I think we have another bug on this somewhere too and we just need to spend the time to get the mapping right.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy
Sent: Wednesday, November 05, 2008 4:43 PM
To: Discussion of IronPython
Subject: [IronPython] _WindowsError and errno

Hi IronPython team,
Is there any reason why _WindowsError sets errno to 22 in all cases?
There's some code in Django that checks if e.errno = errno.EEXIST. The
exception that gets thrown by IronPython has winerror = 17 (and the
message string says "[Errno 17]..."!), but e.errno is 22 (EINVAL).

Fixing #19310 would avoid the problem in this case (it's the same
chunk of code), but I'm curious in general what the reason is.

- Jeff
Users mailing list
Users at lists.ironpython.com

More information about the Ironpython-users mailing list