Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

UnicodeEncodeError

By
Marko
on 7/29/14, 2:22 AM 4,968 views

When trying to print a an invoice I get:

2014-07-29 06:08:51,048 1057 ERROR openerp openerp.service.web_services: Exception: 'ascii' codec can't encode character u'\u010d' in position 6: ordinal not in range(128)
Traceback (most recent call last):
  File "/opt/openerp-7.0-20140728-231228/openerp/service/web_services.py", line 712, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/opt/openerp-7.0-20140728-231228/openerp/report/report_sxw.py", line 442, in create
    fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
  File "/opt/openerp-7.0-20140728-231228/openerp/report/report_sxw.py", line 476, in create_source_pdf
    result = self.create_single_pdf(cr, uid, [obj.id], data, report_xml, context)
  File "/opt/openerp-7.0-20140728-231228/openerp/report/report_sxw.py", line 533, in create_single_pdf
    pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
  File "/opt/openerp-7.0-20140728-231228/openerp/report/interface.py", line 206, in create_pdf
    obj.render()
  File "/opt/openerp-7.0-20140728-231228/openerp/report/render/render.py", line 59, in render
    self._result = self._render()
  File "/opt/openerp-7.0-20140728-231228/openerp/report/render/rml.py", line 41, in _render
    return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
  File "/opt/openerp-7.0-20140728-231228/openerp/report/render/rml2pdf/trml2pdf.py", line 1032, in parseNode
    r.render(fp)
  File "/opt/openerp-7.0-20140728-231228/openerp/report/render/rml2pdf/trml2pdf.py", line 328, in render
    pt_obj.render(el)
  File "/opt/openerp-7.0-20140728-231228/openerp/report/render/rml2pdf/trml2pdf.py", line 1012, in render
    self.doc_tmpl.build(fis)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/doctemplate.py", line 890, in build
    self.handle_flowable(flowables)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/doctemplate.py", line 773, in handle_flowable
    if frame.add(f, canv, trySplit=self.allowSplitting):
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/frames.py", line 161, in _add
    w, h = flowable.wrap(aW, h)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/tables.py", line 1173, in wrap
    self._calc(availWidth, availHeight)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/tables.py", line 625, in _calc
    self._calc_height(availHeight,availWidth,W=W)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/tables.py", line 556, in _calc_height
    dW,t = self._listCellGeom(v,w or self._listValueWidth(v),s)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/tables.py", line 397, in _listCellGeom
    vw, vh = v.wrapOn(canv, aW, aH)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/flowables.py", line 121, in wrapOn
    w, h = self.wrap(aW,aH)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/paragraph.py", line 1036, in wrap
    blPara = self.breakLines([first_line_width, later_widths])
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/paragraph.py", line 1244, in breakLines
    words[0:0] = _splitWord(word,maxWidth-spaceWidth-currentWidth,maxWidths,lineno,fontName,fontSize,self.encoding)
  File "/usr/lib/python2.7/dist-packages/reportlab/platypus/paragraph.py", line 553, in _splitWord
    R.append(_SplitText(wordText))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u010d' in position 6: ordinal not in range(128)
2014-07-29 06:08:51,171 1057 ERROR openerp openerp.netsvc: ascii
Jediničn
6
7
ordinal not in range(128)
(<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u'Jedini\u010dn', 6, 7, 'ordinal not in range(128)'), <traceback object at 0x7f323abdb9e0>)
Traceback (most recent call last):
  File "/opt/openerp-7.0-20140728-231228/openerp/netsvc.py", line 296, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp-7.0-20140728-231228/openerp/service/web_services.py", line 654, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp-7.0-20140728-231228/openerp/service/web_services.py", line 760, in exp_report_get
    return self._check_report(report_id)
  File "/opt/openerp-7.0-20140728-231228/openerp/service/web_services.py", line 738, in _check_report
    netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)
  File "/opt/openerp-7.0-20140728-231228/openerp/netsvc.py", line 71, in abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: (u'ascii\nJedini\u010dn\n6\n7\nordinal not in range(128)', (<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u'Jedini\u010dn', 6, 7, 'ordinal not in range(128)'), <traceback object at 0x7f323abdb9e0>))
2014-07-29 06:08:51,174 1057 INFO openerp werkzeug: 127.0.0.1 - - [29/Jul/2014 06:08:51] "POST /web/report HTTP/1.1" 500 -

 

The language is set to Croatian.

The above error seems to occur when the po files are read for the report like /openerp/addons/account/i18n/hr.po and then it doesn't understand characters like č. Or it can't encode č, I don't know really.

On which operating system and version?

JC
on 8/12/14, 6:54 AM

This is on Ubuntu 14.4.
This same setup is working on gentoo ( latest).
Thanks

On 12 Aug 2014 12:54, "jc" <jcchua@mail.odoo.com> wrote:

On which operating system and version?

--
jc Sent by OpenERP S.A. using Odoo. Access your messages and documents in Odoo
Marko
on 8/12/14, 10:02 AM
3

JC

--JC--
807
| 5 1 8
Kuala Lumpur, Malaysia
--JC--

 

JC
On 8/12/14, 11:04 AM

Since you are on ubuntu 14.04, the issue could be due to reportlab 3.0

odoo/openerp7 is using reportlab 2.6 but ubuntu 14.04 upgraded it to reportlab 3.0  Try this:

1) Download reportlab reportlab-2.6.tar.gz (md5)  from https://pypi.python.org/pypi/reportlab/2.6

2) unzip > look for src directory copy reportlab directory to replace reportlab v3 at  /usr/lib/python2.7/dist-packages/reportlab in ubuntu server

Not sure it works on Odoo 8. I can't restart the server if I do this.

Pascal Tremblay
on 12/14/14, 9:41 PM

Still this error for me : writer.writerow((module, type, name, res_id, src, trad)) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128). Even with reportlab 2.6.

Pascal Tremblay
on 12/15/14, 2:13 PM
0
Md Abdur Rahim
On 8/5/15, 7:20 AM

I need HELP, anyone please give me solution for this error...

++++++++++++++++



Odoo

Odoo Server Error

Traceback (most recent call last):

File "/opt/odoo/openerp/http.py", line 537, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/opt/odoo/openerp/http.py", line 574, in dispatch

result = self._call_function(**self.params)

File "/opt/odoo/openerp/http.py", line 310, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/opt/odoo/openerp/service/model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "/opt/odoo/openerp/http.py", line 307, in checked_call

return self.endpoint(*a, **kw)

File "/opt/odoo/openerp/http.py", line 803, in __call__

return self.method(*args, **kw)

File "/opt/odoo/openerp/http.py", line 403, in response_wrap

response = f(*args, **kw)

File "/opt/odoo/addons/web/controllers/main.py", line 948, in call_button

action = self._call_kw(model, method, args, {})

File "/opt/odoo/addons/web/controllers/main.py", line 936, in _call_kw

return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/addons/base/module/module.py", line 446, in button_immediate_install

return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/addons/base/module/module.py", line 494, in _button_immediate_function

registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)

File "/opt/odoo/openerp/modules/registry.py", line 370, in new

openerp.modules.load_modules(registry._db, force_demo, status, update_module)

File "/opt/odoo/openerp/modules/loading.py", line 355, in load_modules

loaded_modules, update_module)

File "/opt/odoo/openerp/modules/loading.py", line 255, in load_marked_modules

loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)

File "/opt/odoo/openerp/modules/loading.py", line 157, in load_module_graph

init_module_models(cr, package.name, models)

File "/opt/odoo/openerp/modules/module.py", line 286, in init_module_models

result = obj._auto_init(cr, {'module': module_name})

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/models.py", line 2636, in _auto_init

self._set_default_value_on_column(cr, k, context=context)

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/models.py", line 2398, in _set_default_value_on_column

default = default(self, cr, SUPERUSER_ID, context)

File "/opt/odoo/addons/account/account.py", line 1219, in _get_period

period_ids = self.pool.get('account.period').find(cr, uid, context=ctx)

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/addons/account/account.py", line 1046, in find

model, action_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'action_account_period')

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/addons/base/ir/ir_model.py", line 968, in get_object_reference

return self.xmlid_lookup(cr, uid, "%s.%s" % (module, xml_id))[1:3]

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "<string>", line 2, in xmlid_lookup

File "/opt/odoo/openerp/tools/cache.py", line 74, in lookup

value = d[key] = self.method(*args, **kwargs)

File "/opt/odoo/openerp/addons/base/ir/ir_model.py", line 926, in xmlid_lookup

raise ValueError('External ID not found in the system: %s' % (xmlid))

ValueError: External ID not found in the system: account.action_account_period

0
Balvant
On 7/17/15, 2:50 PM

i faced same problem. please help.


return self.app(environ, start_wrapped)

File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__

return self.app(environ, start_response)

File "/opt/odoo/openerp/http.py", line 1441, in dispatch

return response(environ, start_response)

File "/usr/lib/python2.7/dist-packages/werkzeug/wrappers.py", line 1200, in __call__

app_iter, status, headers = self.get_wsgi_response(environ)

File "/usr/lib/python2.7/dist-packages/werkzeug/wrappers.py", line 1190, in get_wsgi_response

return app_iter, self.status, headers.to_wsgi_list()

File "/usr/lib/python2.7/dist-packages/werkzeug/datastructures.py", line 1185, in to_wsgi_list

return [(k, v.encode('latin1')) for k, v in self]

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 49-53: ordinal not in range(256)


0
Gratien HOUNDAKO
On 5/29/15, 12:15 PM

thanks jc :-)

0
Marko
On 8/25/14, 8:41 AM

That was it, thanks jc :-)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

4 follower(s)

Stats

Asked: 7/29/14, 2:22 AM
Seen: 4968 times
Last updated: 8/5/15, 7:20 AM