what exceptions may file() and read() throw?

Daniel Schüle uval at rz.uni-karlsruhe.de
Fri Jun 23 16:44:09 CEST 2006


> You can't easily list the exceptions that your code could throw. There are
> some obvious ones apart from IOError: say filename was an int (or even
> certain strings) you would get TypeError, or you might get MemoryError or
> KeyboardInterrupt. More obscurely, if you reused file as a global variable
> you could generate any exception at all.

I undestand now, so it would be better to let it in the code
in case it's triggered (I triggered it by passing int instead of str, as you 
I would at least know where to look
I wouldn't call it "dead code" then ... dead code is more like

if False:

thank you

Regards, Daniel

More information about the Python-list mailing list