Mod: add error handling in Python lexer