how to abort on syntax errors

Marc 'BlackJack' Rintsch bj_666 at
Mon Mar 26 20:01:58 CEST 2007

In <46080186$0$14151$b45e6eb0 at>, Josh wrote:

> I have a lot of except Exception, e statements in my code, which poses some 
> problems. One of the biggest is whenever I refactor even the triviallest 
> thing in my code.
> I would like python to abort, almost as if it were a compile-time error, 
> whenever it cannot find a function, or if I introduced a syntax error. But, 
> instead, it merrily proceeds on its way.
> Is there some idiom that you use in situations like these?

Just don't use so many ``except Exception:`` constructs that obviously
swallow exceptions they shouldn't swallow.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list