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


Groups > comp.lang.python > #46177

Re: Python error codes and messages location

References <BLU176-W2F86295ACD2E1CD29375BD7960@phx.gbl> <20130527061154.GA3301@cskk.homeip.net>
Date 2013-05-27 17:47 +1000
Subject Re: Python error codes and messages location
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2240.1369640875.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, May 27, 2013 at 4:11 PM, Cameron Simpson <cs@zip.com.au> wrote:
> On 27May2013 04:49, Carlos Nepomuceno <carlosnepomuceno@outlook.com> wrote:
> | That's bad! I'd like to check all the IOError codes that may be
> | raised by a function/method but the information isn't there.
>
> No, you really don't.

Heh. I concur. Opening a file can generate roughly forty-two million
different errors. Here's a smattering that you might not be expecting:

* The path points somewhere that's not currently mounted
* The path represents a device that is not properly working
* It's over a network and the server at the far end is down
* It's over a network and the server sends back maliciously crafted data
* It's over a network and the server sends back an incorrect error code
* You tried to open something that doesn't exist, and your disk quota is used up
* The system has run out of handles
* You're trying to create something in the root directory of a FAT
volume that already has too many root directory entries

And plenty more besides. Those are just a few that I could come up
with off the top of my head.

Just catch whatever makes sense (IOError maybe), and don't sweat the details.

ChrisA

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


Thread

Re: Python error codes and messages location Chris Angelico <rosuav@gmail.com> - 2013-05-27 17:47 +1000

csiph-web