How to process syntax errors

mr.puneet.goyal at gmail.com mr.puneet.goyal at gmail.com
Mon Oct 10 10:13:06 EDT 2016


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 



More information about the Python-list mailing list