OpenERP application sale_report_html encounters the following error on my Ubuntu 12.10, OpenERP 6.1 and Mako 0.7.1-1 system.
Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
(<class 'mako.exceptions.compileexception'="">, CompileException("Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0",), <traceback object="" at="" 0xb43e9bbc="">)
and the /var/log/openerp-server.log
2013-03-05 23:34:32,129 18019 ERROR ? openerp.service.web_services: Exception: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 727, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 442, in create
fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 454, in create_source_mako2html
return self.create_single_mako2html(cr, uid, ids, data, report_xml, context or {})
File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 677, in create_single_mako2html
html = create_doc(mako_html,html_parser.localcontext)
File "/usr/lib/pymodules/python2.7/openerp/report/interface.py", line 243, in create_makohtml2html
obj.render()
File "/usr/lib/pymodules/python2.7/openerp/report/render/render.py", line 59, in render
self._result = self._render()
File "/usr/lib/pymodules/python2.7/openerp/report/render/rml.py", line 91, in _render
return makohtml.parseNode(self.html,self.localcontext)
File "/usr/lib/pymodules/python2.7/openerp/report/render/makohtml2html/makohtml2html.py", line 135, in parseNode
return r.render()
File "/usr/lib/pymodules/python2.7/openerp/report/render/makohtml2html/makohtml2html.py", line 119, in render
template = Template(self.html, lookup=temp_lookup)
File "/usr/lib/python2.7/dist-packages/mako/template.py", line 206, in __init__
(code, module) = _compile_text(self, text, filename)
File "/usr/lib/python2.7/dist-packages/mako/template.py", line 484, in _compile_text
node = lexer.parse()
File "/usr/lib/python2.7/dist-packages/mako/lexer.py", line 192, in parse
self.filename,)
File "/usr/lib/python2.7/dist-packages/mako/lexer.py", line 184, in decode_raw_stream
0, 0, filename)
CompileException: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
2013-03-05 23:34:32,358 18019 ERROR ? openerp.netsvc: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
(<class 'mako.exceptions.compileexception'="">, CompileException("Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0",), <traceback object="" at="" 0xb8071e4="">)
I've made no changes to sale_report_html other than "mv __terp__.py __openerp__.py" which I was told is required.
One suggestion I'd encountered said that I should change all the string references in sale_order_html.mako from ${ 'this is some string' } to ${ u'this is some string' }. And I'm willing to do that, but; most of the string references are of the form ${ o.partner_id.title or '' } and I'm unsure how to convert that to unicode.
What do you suggest?
Making the template file (sale_report_html.mako) line one = "## -- encoding: utf-8 --" is not the solution I had hoped for.
I updated my answer. For the third error, try to comment line mako header xor footer. Bye