On Mon, May 27, 2013 at 4:11 PM, Cameron Simpson <c...@zip.com.au> wrote: > On 27May2013 04:49, Carlos Nepomuceno <carlosnepomuc...@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 -- http://mail.python.org/mailman/listinfo/python-list