How to process syntax errors

breamoreboy at gmail.com breamoreboy at gmail.com
Mon Oct 10 15:52:48 EDT 2016


On Monday, October 10, 2016 at 3:15:40 PM UTC+1, mr.pune... at gmail.com wrote:
> Hi 
> 
> Is there any way to capture syntax errors and process them ? I want to write a function which calls every time whenever there is syntax error in the program.
> 
> For example, 
> 
> inside example.py 
> 
> I just mention below line 
> 
> 
> Obj = myClass()
> Obj xyz
> 
> Obj is instance of a class. But there is syntax error on xyz. So I want to grab that error and process.
> 
> Regards, Puneet

Simple, catch it in your IDE, no need to try and get clever.

Kindest regards.

Mark Lawrence.



More information about the Python-list mailing list