Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5982

Re: List of WindowsError error codes and meanings

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'attributes': 0.05; 'from:addr:pobox.com': 0.07; 'raised': 0.07; 'raises': 0.07; 'python': 0.08; 'attribute': 0.09; 'attribute.': 0.09; 'mapped': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subclass': 0.09; 'thrown': 0.09; 'api': 0.11; 'subject:error': 0.11; 'linux': 0.11; 'exception': 0.12; 'code).': 0.16; 'disadvantage': 0.16; 'errno': 0.16; 'mapping.': 0.16; 'message-id:@post.gmane.org': 0.16; 'mixture': 0.16; 'oserror': 0.16; 'sourceforge': 0.16; 'stupid,': 0.16; 'windowserror': 0.16; 'mapping': 0.19; 'writes:': 0.19; '2.5,': 0.23; 'code': 0.24; "doesn't": 0.25; 'point,': 0.25; '(and': 0.25; 'subject:List': 0.26; 'match': 0.26; 'windows': 0.26; "i'm": 0.27; 'raise': 0.28; 'instead': 0.29; 'least': 0.30; 'module': 0.30; 'usage': 0.32; "can't": 0.32; 'andrew': 0.32; 'cases': 0.32; 'maps': 0.32; 'words,': 0.32; 'header:X-Complaints- To:1': 0.32; 'does': 0.33; 'to:addr:python-list': 0.33; "isn't": 0.33; 'too': 0.33; 'error': 0.33; 'that,': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'test': 0.35; 'quite': 0.36; 'actual': 0.36; 'charset:us-ascii': 0.36; 'presence': 0.37; '(to': 0.37; 'think': 0.38; 'received:org': 0.38; 'could': 0.38; 'but': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'doing': 0.39; 'should': 0.39; 'aside': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'john': 0.62; 'grab': 0.63; 'today': 0.69; 'benefit': 0.70; 'calls,': 0.84; 'presumably': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From John Lee <jjl@pobox.com>
Subject Re: List of WindowsError error codes and meanings
Date Sun, 22 May 2011 17:55:04 +0000 (UTC)
References <mailman.1847.1305914213.9059.python-list@python.org> <8762p48eel.fsf@pobox.com> <ir8m4b$f16$3@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host sea.gmane.org
User-Agent Loom/3.14 (http://gmane.org/)
X-Loom-IP 82.44.73.236 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.10 Chromium/11.0.696.68 Chrome/11.0.696.68 Safari/534.24)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1920.1306086918.9059.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 82.94.164.166
X-Trace 1306086918 news.xs4all.nl 49180 [::ffff:82.94.164.166]:43508
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5982

Show key headers only | View raw


Genstein <genstein <at> invalid.invalid> writes:

> 
> > Andrew Berg<bahamutzero8825 <at> gmail.com>  writes:
> > Since Python 2.5, the errno attribute maps the Windows error to error
> > codes that match the attributes of module errno.
> 
> Good point, I completely misread that. At least the Windows error code 
> is still available as the winerror attribute.
> 
> As an aside - call me stupid, but I don't quite follow the purpose of 
> that errno mapping. Surely if the error number can be mapped 
> successfully then the error isn't Windows specific and an OSError should 
> logically be thrown instead? And if it can't be mapped successfully then 
> errno will never be valid so the mapping is pointless?

Since WindowsError is a subclass of OSError, .errno has to be there (and it must 
contain the UNIXy error code).  You could then ask why it's a subclass in the 
first place.  I think part of the answer is that the docs are wrong -- 
presumably actual usage is that WindowsError is raised when a Windows API call 
is made that *may* result in an exception that has no corresponding errno value 
("presumably" because I'm writing on Linux & sourceforge is too slow for me 
today to grab pywin32).  In other words, code that raises WindowsError doesn't 
try to test the error code so that it can raise OSError instead some of the 
time.  I don't think there would be any benefit in doing that, and it would have 
the disadvantage that with those calls, you'd have to deal with a mixture of 
Windows and UNIXy error codes.

The presence of .errno, aside from being required (to satisfy LSP), does mean 
you don't have to deal with the Windows codes if you're only interested in cases 
covered by module errno.


John

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

List of WindowsError error codes and meanings Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-20 12:56 -0500
  Re: List of WindowsError error codes and meanings Genstein <genstein@invalid.invalid> - 2011-05-20 20:47 +0100
    Re: List of WindowsError error codes and meanings Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-20 16:55 -0500
  Re: List of WindowsError error codes and meanings John J Lee <jjl@pobox.com> - 2011-05-21 12:46 +0100
    Re: List of WindowsError error codes and meanings Genstein <genstein@invalid.invalid> - 2011-05-21 16:35 +0100
      Re: List of WindowsError error codes and meanings John Lee <jjl@pobox.com> - 2011-05-22 17:55 +0000
    Re: List of WindowsError error codes and meanings Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-22 09:35 -0500
  Re: List of WindowsError error codes and meanings Thomas Heller <theller@ctypes.org> - 2011-05-26 17:02 +0200
    Re: List of WindowsError error codes and meanings Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-27 04:22 -0500

csiph-web