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

Bruno Desthuilliers onurb at xiludom.gro
Fri Jun 23 11:13:01 EDT 2006


Daniel Schüle wrote:
> Hi
> 
> 
>>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 

Nope. Let it propagate, so you have a full traceback. traceback are usefull.




-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list