Exception Handling

dieter dieter at handshake.de
Sat Apr 11 07:39:23 CEST 2015


Palpandi <palpandi111 at gmail.com> writes:

> Thanks for your responses. And I have one more question.
> This is the situation. A python application which reads data from one .xml file and generates some other file. Here what kind of exceptions occur?

Ideally, you would not get any exceptions.

In the not ideal case, you may get exceptions from the XML parser
(in case, your XML input file is not valid), the "os" module
(for permission or filesystem related problems) and potentially
exceptions (such as "AttributeError") from your own program logic
(in case it would be faulty).

I support Chris' recommendation to not care about exceptions intially
(as they are exceptions - and do not occur frequently) and
decide what to do should they really occur.




More information about the Python-list mailing list