Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Error debugging

Nate Smith edited this page Oct 1, 2013 · 1 revision

If you encounter errors in the update script, you'll be able to debug by reading the output.

An error output will look something like:

Traceback (most recent call last):
  File "undp-process-xml.py", line 568, in <module>
    loopData(projects_file,'document-link')
  File "undp-process-xml.py", line 407, in loopData
    for event, p in context:
  File "iterparse.pxi", line 487, in lxml.etree.iterparse.__next__ (src/lxml/lxml.etree.c:115125)
  File "iterparse.pxi", line 540, in lxml.etree.iterparse._read_more_events (src/lxml/lxml.etree.c:115707)
  File "parser.pxi", line 616, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:85258)
lxml.etree.XMLSyntaxError: xmlParseEntityRef: no name, line 38, column 43

On the last line you'll see xmlParseEntityRef: no name, line 38, column 43. This shows that the error is happening because of parse error within the Python lxml library. It also shows that the error is coming from line 38. This is referencing the xml file line where there error is happening. column 43 is referencing the exact character column where the error took place, but reviewing the entire line will help you debug. A parse error could happen if there are invalid characters or invalid XML.

Based on what you determine is the problem, then the XML can be fixed and the script can be rerun.

Clone this wiki locally