Fix #33
Check for existance of variable "result" when handling ExpatError exception.
This commit is contained in:
parent
d0bdea1874
commit
a827b28f48
1 changed files with 2 additions and 0 deletions
|
|
@ -551,6 +551,8 @@ class Renderer(object):
|
|||
|
||||
return final_xml
|
||||
except ExpatError as e:
|
||||
if not 'result' in locals():
|
||||
result = xml_source
|
||||
near = result.split('\n')[e.lineno -1][e.offset-200:e.offset+200]
|
||||
raise ExpatError('ExpatError "%s" at line %d, column %d\nNear of: "[...]%s[...]"' % \
|
||||
(ErrorString(e.code), e.lineno, e.offset, near))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue