模块在windows下安装正常,在linux下安装出错
-
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 0: ordinal not in range(128)
不知道怎么回事,有不少东东在windows下OK,但在linux下就是不行,不知道是否有人碰到过同样的问题。
-
把具体的问题和log弄上来看看。
这个UnicodeDecodeError的产生是由于要将byte string就是普通的字符串转化为Unicode字符串时,因为原字符串中有[b]非[/b]Ascii码的字符比如中文,而解码时又没有提供该字符串的编码,导致Python使用默认的Ascii来解码,从而出错。
这样的问题确实不少,只能具体问题具体分析了。
-
[2010-01-14 07:51:11,254] ERROR:web-services:[01]:
[2010-01-14 07:51:11,255] ERROR:web-services:[02]: Environment Information :
[2010-01-14 07:51:11,255] ERROR:web-services:[03]: System : Linux-2.6.18-164.9.1.el5PAE-i686-with-redhat-5.4-Final
[2010-01-14 07:51:11,255] ERROR:web-services:[04]: OS Name : posix
[2010-01-14 07:51:11,255] ERROR:web-services:[05]: LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
[2010-01-14 07:51:11,255] ERROR:web-services:[06]: Distributor ID: CentOS
[2010-01-14 07:51:11,255] ERROR:web-services:[07]: Description: CentOS release 5.4 (Final)
[2010-01-14 07:51:11,255] ERROR:web-services:[08]: Release: 5.4
[2010-01-14 07:51:11,256] ERROR:web-services:[09]: Codename: Final
[2010-01-14 07:51:11,256] ERROR:web-services:[10]: Operating System Release : 2.6.18-164.9.1.el5PAE
[2010-01-14 07:51:11,256] ERROR:web-services:[11]: Operating System Version : #1 SMP Tue Dec 15 21:41:47 EST 2009
[2010-01-14 07:51:11,256] ERROR:web-services:[12]: Operating System Architecture : 32bit
[2010-01-14 07:51:11,256] ERROR:web-services:[13]: Operating System Locale : NOT SET
[2010-01-14 07:51:11,256] ERROR:web-services:[14]: Python Version : 2.4.3
[2010-01-14 07:51:11,256] ERROR:web-services:[15]: OpenERP-Server Version : 5.0.6
[2010-01-14 07:51:11,257] ERROR:web-services:[16]: Last revision No. & ID :
[2010-01-14 07:51:11,257] ERROR:web-services:[17]: Exception in call: Traceback (most recent call last):
[2010-01-14 07:51:11,257] ERROR:web-services:[18]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/wizard/init.py", line 74, in execute_cr
[2010-01-14 07:51:11,257] ERROR:web-services:[19]: action_res = action(self, cr, uid, data, context)
[2010-01-14 07:51:11,257] ERROR:web-services:[20]: File "/home/chengwenge/bin/5.0.6/openerp-server-5.0.6/bin/addons/base/module/wizard/wizard_module_upgrade.py", line 92, in _upgrade_module
[2010-01-14 07:51:11,257] ERROR:web-services:[21]: db, pool = pooler.restart_pool(cr.dbname, update_module=True)
[2010-01-14 07:51:11,258] ERROR:web-services:[22]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/pooler.py", line 62, in restart_pool
[2010-01-14 07:51:11,258] ERROR:web-services:[23]: return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
[2010-01-14 07:51:11,258] ERROR:web-services:[24]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/pooler.py", line 40, in get_db_and_pool
[2010-01-14 07:51:11,258] ERROR:web-services:[25]: addons.load_modules(db, force_demo, status, update_module)
[2010-01-14 07:51:11,258] ERROR:web-services:[26]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/addons/init.py", line 728, in load_modules
[2010-01-14 07:51:11,258] ERROR:web-services:[27]: r = load_module_graph(cr, graph, status, report=report)
[2010-01-14 07:51:11,258] ERROR:web-services:[28]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/addons/init.py", line 581, in load_module_graph
[2010-01-14 07:51:11,259] ERROR:web-services:[29]: init_module_objects(cr, package.name, modules)
[2010-01-14 07:51:11,259] ERROR:web-services:[30]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/addons/init.py", line 366, in init_module_objects
[2010-01-14 07:51:11,259] ERROR:web-services:[31]: result = obj._auto_init(cr, {'module': module_name})
[2010-01-14 07:51:11,259] ERROR:web-services:[32]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/osv/orm.py", line 1649, in _auto_init
[2010-01-14 07:51:11,259] ERROR:web-services:[33]: self._field_create(cr, context=context)
[2010-01-14 07:51:11,259] ERROR:web-services:[34]: File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/osv/orm.py", line 396, in _field_create
[2010-01-14 07:51:11,259] ERROR:web-services:[35]: if cols[k][key] != vals[key]:
[2010-01-14 07:51:11,260] ERROR:web-services:[36]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 0: ordinal not in range(128) -
看来这个地方的源代码,没有搞明白,help me.
-
从log看是在安装模块到创建字段时出了‘UnicodeDecodeError'。所以大概你的实体类中的字段定义中用了非Ascii码的字符,是中文吗? 是不是应该用unicode字符串的地方比如:u'中文', 用成了byte string: '中文'。如果在unicode字符串中用了中文字符,还要注意在源文件的起始位置定义encoding。
如果在windows下可以安装,linux下出错,看看这里是不是出错的原因: www.shine-it.net/viewthread.php?tid=581&extra=page%3D2
[[i] 本帖最后由 digitalsatori 于 2010-1-15 00:56 编辑 [/i]]
-
安装报表不成,搞的原来都是好的模块都不能保持,救命,郁闷。
Traceback (most recent call last):
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/netsvc.py", line 244, in dispatch
result = LocalService(service_name)(method, *params)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/netsvc.py", line 73, in call
return getattr(self, method)(*params)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/service/web_services.py", line 583, in execute
res = service.execute(db, uid, object, method, *args)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/osv/osv.py", line 59, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/osv/osv.py", line 118, in execute
res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/osv/osv.py", line 110, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/osv/orm.py", line 2653, in create
cr.execute(sql)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/sql_db.py", line 76, in wrapper
return f(self, *args, **kwargs)
File "/home/chengwenge/lib/python2.4/openerp_server-5.0.6-py2.4.egg/openerp-server/sql_db.py", line 120, in execute
res = self._obj.execute(query, params)
TypeError: argument 1 must be a string or unicode object -
原因未明,重新安装server就可以了。