Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

求助: 操作模块出现UnicodeDecodeError



  • 大家好, 初来乍到就碰到了不小的问题:
    我在ubuntu server 10.04上装了openerp server 和 web 5.0.10, 用win7的客户端去连接. 一切都很顺利, 直到进入模块列表Modules时, 客户端出现了以下错误:


    Environment Information :
    System : Windows-32bit
    OS Name : nt
    Operating System Release :
    Operating System Version : 32bit
    Operating System Architecture : 32bit
    Operating System Locale : zh_CN.cp936
    Python Version : 2.5.2
    OpenERP-Client Version : 5.0.10
    Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
      File "/root/erp/openerp-server-5.0.10/bin/netsvc.py", line 245, in dispatch
        result = LocalService(service_name)(method, *params)
      File "/root/erp/openerp-server-5.0.10/bin/netsvc.py", line 74, in call
        return getattr(self, method)(*params)
      File "/root/erp/openerp-server-5.0.10/bin/service/web_services.py", line 576, in execute
        res = service.execute(db, uid, object, method, *args)
      File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 58, in wrapper
        return f(self, dbname, *args, **kwargs)
      File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 119, in execute
        res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
      File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 111, in execute_cr
        return getattr(object, method)(cr, uid, *args, **kw)
      File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2225, in read
        result = self._read_flat(cr, user, select, fields, context, load)
      File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2297, in _read_flat
        res.extend(cr.dictfetchall())
      File "/usr/lib/python2.6/dist-packages/psycopg2/psycopg1.py", line 83, in dictfetchall
        rows = _2cursor.fetchall(self)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25: ordinal not in range(128)

    服务器端的报错如下:
    sh: bzr: not found
    No LSB modules are available.
    [2010-06-09 15:33:35,323] ERROR:web-services:[01]:
    [2010-06-09 15:33:35,323] ERROR:web-services:[02]: Environment Information :
    [2010-06-09 15:33:35,323] ERROR:web-services:[03]: System : Linux-2.6.32-22-generic-pae-i686-with-Ubuntu-10.04-lucid
    [2010-06-09 15:33:35,323] ERROR:web-services:[04]: OS Name : posix
    [2010-06-09 15:33:35,323] ERROR:web-services:[05]: Distributor ID:      Ubuntu
    [2010-06-09 15:33:35,324] ERROR:web-services:[06]: Description: Ubuntu 10.04 LTS
    [2010-06-09 15:33:35,324] ERROR:web-services:[07]: Release:    10.04
    [2010-06-09 15:33:35,324] ERROR:web-services:[08]: Codename:    lucid
    [2010-06-09 15:33:35,324] ERROR:web-services:[09]: Operating System Release : 2.6.32-22-generic-pae
    [2010-06-09 15:33:35,324] ERROR:web-services:[10]: Operating System Version : #33-Ubuntu SMP Wed Apr 28 14:57:29 UTC 2010
    [2010-06-09 15:33:35,324] ERROR:web-services:[11]: Operating System Architecture : 32bit
    [2010-06-09 15:33:35,324] ERROR:web-services:[12]: Operating System Locale : zh_CN.UTF8
    [2010-06-09 15:33:35,325] ERROR:web-services:[13]: Python Version : 2.6.5
    [2010-06-09 15:33:35,325] ERROR:web-services:[14]: OpenERP-Server Version : 5.0.10
    [2010-06-09 15:33:35,325] ERROR:web-services:[15]: Last revision No. & ID :
    [2010-06-09 15:33:35,325] ERROR:web-services:[16]: Traceback (most recent call last):
    [2010-06-09 15:33:35,325] ERROR:web-services:[17]:  File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 58, in wrapper
    [2010-06-09 15:33:35,325] ERROR:web-services:[18]:    return f(self, dbname, *args, **kwargs)
    [2010-06-09 15:33:35,325] ERROR:web-services:[19]:  File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 119, in execute
    [2010-06-09 15:33:35,326] ERROR:web-services:[20]:    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
    [2010-06-09 15:33:35,326] ERROR:web-services:[21]:  File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 111, in execute_cr
    [2010-06-09 15:33:35,326] ERROR:web-services:[22]:    return getattr(object, method)(cr, uid, *args, **kw)
    [2010-06-09 15:33:35,326] ERROR:web-services:[23]:  File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2225, in read
    [2010-06-09 15:33:35,326] ERROR:web-services:[24]:    result = self._read_flat(cr, user, select, fields, context, load)
    [2010-06-09 15:33:35,326] ERROR:web-services:[25]:  File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2297, in _read_flat
    [2010-06-09 15:33:35,327] ERROR:web-services:[26]:    res.extend(cr.dictfetchall())
    [2010-06-09 15:33:35,327] ERROR:web-services:[27]:  File "/usr/lib/python2.6/dist-packages/psycopg2/psycopg1.py", line 83, in dictfetchall
    [2010-06-09 15:33:35,327] ERROR:web-services:[28]:    rows = _2cursor.fetchall(self)
    [2010-06-09 15:33:35,327] ERROR:web-services:[29]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25: ordinal not in range(128)

    一开始以为是python版本的问题, 后来被排除了. 在网上找了很久, 发现有类似的问题, 但没有解决的方法.
    不知道是不是服务器字符集和客户端字符集不一致产生的问题? 但在web客户端下问题依然存在.
    不知道大家有没有遇到过类似的情况, 又是如何解决的?



  • 大家好, 初来乍到就碰到了不小的问题:
    我在ubuntu server 10.04上装了openerp server 和 web 5.0.10, 用win7的客户端去连接. 一切都很顺利, 直到进入模块列表Modules时, 客户端出现了以下错误:


    Environment Information :
    System : Windows-32bit
    OS Name : nt
    Operating System Release :
    Operating System Version : 32bit
    Operating System Architecture : 32bit
    Operating System Locale : zh_CN.cp936
    Python Version : 2.5.2
    OpenERP-Client Version : 5.0.10
    Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
      File "/root/erp/openerp-server-5.0.10/bin/netsvc.py", line 245, in dispatch
        result = LocalService(service_name)(method, *params)
      File "/root/erp/openerp-server-5.0.10/bin/netsvc.py", line 74, in call
        return getattr(self, method)(*params)
      File "/root/erp/openerp-server-5.0.10/bin/service/web_services.py", line 576, in execute
        res = service.execute(db, uid, object, method, *args)
      File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 58, in wrapper
        return f(self, dbname, *args, **kwargs)
      File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 119, in execute
        res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
      File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 111, in execute_cr
        return getattr(object, method)(cr, uid, *args, **kw)
      File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2225, in read
        result = self._read_flat(cr, user, select, fields, context, load)
      File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2297, in _read_flat
        res.extend(cr.dictfetchall())
      File "/usr/lib/python2.6/dist-packages/psycopg2/psycopg1.py", line 83, in dictfetchall
        rows = _2cursor.fetchall(self)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25: ordinal not in range(128)

    服务器端的报错如下:
    sh: bzr: not found
    No LSB modules are available.
    [2010-06-09 15:33:35,323] ERROR:web-services:[01]:
    [2010-06-09 15:33:35,323] ERROR:web-services:[02]: Environment Information :
    [2010-06-09 15:33:35,323] ERROR:web-services:[03]: System : Linux-2.6.32-22-generic-pae-i686-with-Ubuntu-10.04-lucid
    [2010-06-09 15:33:35,323] ERROR:web-services:[04]: OS Name : posix
    [2010-06-09 15:33:35,323] ERROR:web-services:[05]: Distributor ID:      Ubuntu
    [2010-06-09 15:33:35,324] ERROR:web-services:[06]: Description: Ubuntu 10.04 LTS
    [2010-06-09 15:33:35,324] ERROR:web-services:[07]: Release:    10.04
    [2010-06-09 15:33:35,324] ERROR:web-services:[08]: Codename:    lucid
    [2010-06-09 15:33:35,324] ERROR:web-services:[09]: Operating System Release : 2.6.32-22-generic-pae
    [2010-06-09 15:33:35,324] ERROR:web-services:[10]: Operating System Version : #33-Ubuntu SMP Wed Apr 28 14:57:29 UTC 2010
    [2010-06-09 15:33:35,324] ERROR:web-services:[11]: Operating System Architecture : 32bit
    [2010-06-09 15:33:35,324] ERROR:web-services:[12]: Operating System Locale : zh_CN.UTF8
    [2010-06-09 15:33:35,325] ERROR:web-services:[13]: Python Version : 2.6.5
    [2010-06-09 15:33:35,325] ERROR:web-services:[14]: OpenERP-Server Version : 5.0.10
    [2010-06-09 15:33:35,325] ERROR:web-services:[15]: Last revision No. & ID :
    [2010-06-09 15:33:35,325] ERROR:web-services:[16]: Traceback (most recent call last):
    [2010-06-09 15:33:35,325] ERROR:web-services:[17]:  File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 58, in wrapper
    [2010-06-09 15:33:35,325] ERROR:web-services:[18]:    return f(self, dbname, *args, **kwargs)
    [2010-06-09 15:33:35,325] ERROR:web-services:[19]:  File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 119, in execute
    [2010-06-09 15:33:35,326] ERROR:web-services:[20]:    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
    [2010-06-09 15:33:35,326] ERROR:web-services:[21]:  File "/root/erp/openerp-server-5.0.10/bin/osv/osv.py", line 111, in execute_cr
    [2010-06-09 15:33:35,326] ERROR:web-services:[22]:    return getattr(object, method)(cr, uid, *args, **kw)
    [2010-06-09 15:33:35,326] ERROR:web-services:[23]:  File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2225, in read
    [2010-06-09 15:33:35,326] ERROR:web-services:[24]:    result = self._read_flat(cr, user, select, fields, context, load)
    [2010-06-09 15:33:35,326] ERROR:web-services:[25]:  File "/root/erp/openerp-server-5.0.10/bin/osv/orm.py", line 2297, in _read_flat
    [2010-06-09 15:33:35,327] ERROR:web-services:[26]:    res.extend(cr.dictfetchall())
    [2010-06-09 15:33:35,327] ERROR:web-services:[27]:  File "/usr/lib/python2.6/dist-packages/psycopg2/psycopg1.py", line 83, in dictfetchall
    [2010-06-09 15:33:35,327] ERROR:web-services:[28]:    rows = _2cursor.fetchall(self)
    [2010-06-09 15:33:35,327] ERROR:web-services:[29]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25: ordinal not in range(128)

    一开始以为是python版本的问题, 后来被排除了. 在网上找了很久, 发现有类似的问题, 但没有解决的方法.
    不知道是不是服务器字符集和客户端字符集不一致产生的问题? 但在web客户端下问题依然存在.
    不知道大家有没有遇到过类似的情况, 又是如何解决的?


  • 管理员

    给出的错误信息不足以定位错误所在。
    UnicodeDecodeError 一般发生在字节码编码字符串转换为Unicode字符串时未提供字节码编码字符串的编码方式,Python因此使用了默认的ASCII编码来解码非ASCII编码字符串造成的。

    在英文界面下会有相同的错误吗?



  • 我用的都是英文的, 没有换过语言包. 应该不会出现转码问题, 所以才感到很费解.
    我已经反复确定了安装过程, 没有发现任何错误.
    Errrorlog里也没有给出更多的信息.



  • 问题找到了!
    是数据库编码的问题!
    postgres的默认编码是sql_ascii. 在创建数据库时要选择utf8字符集.
    但在phppgadmin中创建的话, 会出现utf8不被兼容的错误. 解决办法是, 进入shell切换到postgres, 然后$ createdb -O user -E UTF8 -T template0 mydb
    这应该是很常见的问题, 但oe官方的doc和论坛里都没有提及, 真是奇怪.



  • 在phppgadmin中创建,为什么呢?
    openerp客户端本身可以调用创建数据库的命令啊,何必自己去创建呢?