You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we are using mako as template engine for generating latex-reports in tryton.
After an update of the source system from python 3.3 to python 3.5 migration, we get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/trytond/worker.py", line 108, in run_task
Queue(task_id).run()
File "/usr/local/lib/python3.7/dist-packages/trytond/ir/queue.py", line 169, in run
instances, *self.data['args'], **self.data['kwargs'])
File "/usr/local/lib/python3.7/dist-packages/trytond/model/modelview.py", line 672, in wrapper
return func(cls, records, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/sale/sale.py", line 885, in process
sale.create_invoice()
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/ebb_sale/sale.py", line 287, in create_invoice
Invoice.post([invoice])
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/sale/invoice.py", line 20, in wrapper
func(cls, invoices)
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/sale/invoice.py", line 87, in post
super(Invoice, cls).post(invoices)
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/purchase/invoice.py", line 21, in wrapper
func(cls, invoices)
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/purchase/invoice.py", line 98, in post
super(Invoice, cls).post(invoices)
File "/usr/local/lib/python3.7/dist-packages/trytond/model/modelview.py", line 672, in wrapper
return func(cls, records, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/trytond/model/workflow.py", line 36, in wrapper
result = func(cls, filtered, *args, **kwargs)
nvoice.py", line 1383, in post.7/dist-packages/trytond/modules/account_invoice/i--More--
invoice.print_invoice()
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/account_invoice/invoice.py", line 1292, in print_invoice
InvoiceReport.execute([self.id], {})
File "/usr/local/lib/python3.7/dist-packages/trytond/modules/latex_reports/latex.py", line 282, in execute
mytemplate = Template(filename=report_path.replace('.odt','.tex'), cache_enabled=False, input_encoding='utf-8', output_encoding='utf-8')
File "/usr/local/lib/python3.7/dist-packages/mako/template.py", line 338, in __init__
module = self._compile_from_file(path, filename)
File "/usr/local/lib/python3.7/dist-packages/mako/template.py", line 416, in _compile_from_file
filename)
File "/usr/local/lib/python3.7/dist-packages/mako/template.py", line 705, in _compile_text
generate_magic_comment=template.disable_unicode)
File "/usr/local/lib/python3.7/dist-packages/mako/template.py", line 685, in _compile
node = lexer.parse()
File "/usr/local/lib/python3.7/dist-packages/mako/lexer.py", line 241, in parse
if self.match_expression():
File "/usr/local/lib/python3.7/dist-packages/mako/lexer.py", line 402, in match_expression
lineno=line, pos=pos)
File "/usr/local/lib/python3.7/dist-packages/mako/lexer.py", line 140, in append_node
node = nodecls(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/mako/parsetree.py", line 194, in __init__
self.code = ast.PythonCode(text, **self.exception_kwargs)
File "/usr/local/lib/python3.7/dist-packages/mako/ast.py", line 40, in __init__
expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
File "/usr/local/lib/python3.7/dist-packages/mako/pyparser.py", line 48, in parse
), **exception_kwargs)
mako.exceptions.SyntaxException: (IndexError) list index out of range ("sale.invoice_address.party_name.replace('&','\\&')") in file '/tmp/trytond-latex-aevzw0qf/invoice.tex' at line: 80 char: 1
What we are wondering about: This does not occurs with the first time. It took some generations, e.g. is it possible, that somehow a caching is used and we should remove it?
We did test this with mako 1.1.3 and 1.0.7.
Thank you and best regards,
Hendrik
The text was updated successfully, but these errors were encountered:
that would not be caching within Mako because that's parsing a .py file. I don't know what the issue is but something is not syntactically working out in a file called "invoice.tex" on your side.
a python 3.3 -> 3.5 migration can potentially impact things because there may be subtle changes in the ast module. but would need to see the failing portion of your invoice.tex file to further diagnose what the problem is.
Hello Mike,
thank you. That was my first thought also, but: If I restart the python
server, the invoice.tex will be created successfully. Until a certain
step - which I actual do not know - leads into this syntax problem. We
also removed that critical section of the tex-template, but then, the
error occurs on some very unspectacular statements as "if x == ..." ...
very strange :-(
Am Montag, den 06.07.2020, 08:22 -0700 schrieb mike bayer:
hi there -
that would not be caching within Mako because that's parsing a .py
file. I don't know what the issue is but something is not
syntactically working out in a file called "invoice.tex" on your
side.
a python 3.3 -> 3.5 migration can potentially impact things because
there may be subtle changes in the ast module. but would need to
see the failing portion of your invoice.tex file to further diagnose
what the problem is.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
yeah something is obviously going very wrong , that error is coming from calling Python compile() directly. if this program runs from the console in the main thread, I'd use pdb to take a closer look at the Python string it is trying to compile.
Hello,
we are using mako as template engine for generating latex-reports in tryton.
After an update of the source system from python 3.3 to python 3.5 migration, we get the following error:
What we are wondering about: This does not occurs with the first time. It took some generations, e.g. is it possible, that somehow a caching is used and we should remove it?
We did test this with mako 1.1.3 and 1.0.7.
Thank you and best regards,
Hendrik
The text was updated successfully, but these errors were encountered: