Report is not well-formed (invalid token)

Our application has several large reports containing images. These reports are normally generating in Tryton 4.6.0. But in Tryton 5.4.8 some of them are no longer generated:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/genshi/input.py", line 161, in _generate
    self.expat.Parse(data, False)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 125549

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/genshi/template/base.py", line 418, in __init__
    self._stream = self._parse(source, encoding)
  File "/usr/local/lib/python3.7/site-packages/relatorio/templates/opendocument.py", line 293, in _parse
    content = template._parse(self.insert_directives(content), encoding)
  File "/usr/local/lib/python3.7/site-packages/genshi/template/markup.py", line 82, in _parse
    for kind, data, pos in source:
  File "/usr/local/lib/python3.7/site-packages/genshi/core.py", line 292, in _ensure
    for event in stream:
  File "/usr/local/lib/python3.7/site-packages/genshi/input.py", line 449, in _coalesce
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/usr/local/lib/python3.7/site-packages/genshi/input.py", line 169, in _generate
    raise ParseError(msg, self.filename, e.lineno, e.offset)
genshi.input.ParseError: not well-formed (invalid token): line 1, column 125549, in /tmp/trytond_65z01gkw.odt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/trytond/protocols/dispatcher.py", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python3.7/site-packages/trytond/report/report.py", line 195, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/usr/local/lib/python3.7/site-packages/trytond/report/report.py", line 203, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/usr/local/lib/python3.7/site-packages/trytond/report/report.py", line 302, in render
    data = rel_report(**report_context).render()
  File "/usr/local/lib/python3.7/site-packages/relatorio/reporting.py", line 121, in __call__
    template = self.tmpl_loader.load(self.fpath, self.mimetype)
  File "/usr/local/lib/python3.7/site-packages/relatorio/reporting.py", line 81, in load
    path, cls=cls, relative_to=relative_to)
  File "/usr/local/lib/python3.7/site-packages/genshi/template/loader.py", line 236, in load
    filename, encoding=encoding)
  File "/usr/local/lib/python3.7/site-packages/genshi/template/loader.py", line 274, in _instantiate
    allow_exec=self.allow_exec)
  File "/usr/local/lib/python3.7/site-packages/relatorio/templates/opendocument.py", line 267, in __init__
    encoding, lookup, allow_exec)
  File "/usr/local/lib/python3.7/site-packages/genshi/template/markup.py", line 67, in __init__
    allow_exec=allow_exec)
  File "/usr/local/lib/python3.7/site-packages/genshi/template/base.py", line 420, in __init__
    raise TemplateSyntaxError(e.msg, self.filepath, e.lineno, e.offset)
genshi.template.base.TemplateSyntaxError: not well-formed (invalid token): line 1, column 125549 (<string>, line 1)

The reports do not contain Genshi directives. These are just odt-documents prepared using OpenOffice and LibreOffice. What is wrong with these reports or relatorio or genshi?

Hi @bell, modules have changed some variables from tryton version 4.6.0 to version 5.4.0, for me you should check this in the .odt report that you used in version 4.6.0 that maybe that variable is not used anymore in version 5.4.8. and maybe the error refers to that.

We do not use any Genshi directives or variables in these .odt reports.

It looks like the odt file does not contain valid XML file.

But the odt file normally opens in OpenOffice and LibreOffice.

That does not guarantee it is a valid XML.

And the same odt file is normally generating in Tryton 4.6.0.

The library is maybe not as strict on this version.
You should first check the file at line 1, column 125549.

We have converted odt files to pdf files.
The pdf-reports are generating normally.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.