How to debug TypeError: required field "lineno" missing from expr?
Mark Lawrence
breamoreboy at yahoo.co.uk
Sun Jun 28 21:14:43 EDT 2015
Purely as an exercise I've been converting Grant Jenks' pypatt[1] from
2.7 to 3.4. I've managed to sort out most of the required changes by
checking on what I can see with an AST pretty printer[2]. So it's
rather frustrating to have the compile stage throw the error given in
the subject line.
The code has a call to the ast fix_missing_locations function. I'm
aware of the Armin Ronacher tweet[3] stating
<quote>
"TypeError: required field "lineno" missing from stmt" — no, what you
actually mean is "tuple is not a statement'.
</quote>
but I don't think this is the problem. Still I've clearly managed to
screw something up somewhere along so line, so any bright ideas as to
how I can proceed?
Further would it be worth raising an enhancement request to get some
better diagnostics from the built-in compile function, or is such a
thing already on the bug tracker? Or is it simply too difficult, or what?
No panic needed, it's past 2am BST and I'm off to bed for my beauty
sleep, so give me a couple of months :)
[1] https://github.com/grantjenks/pypatt_python_pattern_matching
[2] http://alexleone.blogspot.co.uk/2010/01/python-ast-pretty-printer.html
[3] https://twitter.com/mitsuhiko/status/91169383254200320
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list