I am using PLY to parse a file. I have to print a message to the user when I have an error on a line.
A message like Error at the line 4
.
def p_error(p):
flag_for_error = 1
print ("Erreur de syntaxe sur la ligne %d" % (p.lineno))
yacc.errok()
But it is not working. I have the error
print ("Erreur de syntaxe sur la ligne %d" % (p.lineno))
AttributeError: 'NoneType' object has no attribute 'lineno'
Is there another is more suitable way to do that?