原创:odoo导出po翻译文件报错的解决:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in
-
卓忆原创:odoo导出po翻译文件报错的解决:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 1: ordinal not in range(128) 的解决
在导出po文件的时候 报错,报错全文如下:
完整的如下:Traceback (most recent call last):
File "/opt/odoo/odoo-server/openerp/http.py", line 525, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo-server/openerp/http.py", line 562, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo-server/openerp/http.py", line 302, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/http.py", line 299, in checked_call
return self.endpoint(*a, **kw)
File "/opt/odoo/odoo-server/openerp/http.py", line 791, in call
return self.method(*args, **kw)
File "/opt/odoo/odoo-server/openerp/http.py", line 395, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 953, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 941, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/module/wizard/base_export_language.py", line 65, in act_getfile
tools.trans_export(lang, mods, buf, this.format, cr)
File "/opt/odoo/odoo-server/openerp/tools/translate.py", line 510, in trans_export
translations = trans_generate(lang, modules, cr)
File "/opt/odoo/odoo-server/openerp/tools/translate.py", line 875, in trans_generate
for root, dummy, files in osutil.walksymlinks(path):
File "/opt/odoo/odoo-server/openerp/tools/osutil.py", line 56, in walksymlinks
for dirpath, dirnames, filenames in os.walk(top, topdown, onerror):
File "/usr/lib/python2.7/os.py", line 294, in walk
for x in walk(new_path, topdown, onerror, followlinks):
File "/usr/lib/python2.7/os.py", line 284, in walk
if isdir(join(top, name)):
File "/usr/lib/python2.7/posixpath.py", line 80, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 1: ordinal not in range(128)
12:05:36
经过排查,发现可能是某个第三方模块导致的:
那个模块只要放在 addons 目录里面,不用安装,导出依然会报错。
我估计 导出的时候 自动 遍历了整个 addons 目录。
原因是 这个模块的 xml 文件 最前面少了 encoding="utf-8"?
正确的应该是 :
<?xml version="1.0" encoding="utf-8"?>
谢谢joshua和总监mrshelly。