How to process syntax errors

Rob Gaddi rgaddi at highlandtechnology.invalid
Wed Oct 12 12:57:05 EDT 2016


mr.puneet.goyal at gmail.com wrote:

> On Monday, October 10, 2016 at 7:45:40 PM UTC+5:30, 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
>
> Steve, You are absolutely right. I am trying to eliminate the method of using parenthesis while calling in my file. Especially when I call it from a instance.

There's a simple solution then.  Don't do that.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list