2006年11月22日 星期三 12:27
python,您好! 我下了SPE,试了一下,发现对汉字的支持报出错误: 如果在文件第一行写上: # -*- coding: utf-8 -*- 在文件中如果有汉字的话,则保存的时候失败,下部的SHELL中显示: Traceback (most recent call last): File "I:\Python24\Lib\site-packages\_spe\Menu.py", line 271, in menu_save self.app.childActive.save() File "I:\Python24\Lib\site-packages\_spe\Child.py", line 305, in save sourceUnicode = source.decode(self.encoding) File "I:\Python24\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-34: invalid data 请问怎么解决呢? 谢谢 致 礼! cry zyqmail在tom.com
2006年11月22日 星期三 14:02
pythoners, 不知道你的spe是什么版本,我这没有任何问题:) Spe version 0.8.2.a Python version 2.4.2 (2.3 required) wxPython version 2.6.1.0. (2.6.1.0. required) 好像有这么一个文件有必要添加下 位置: $PYTHON_HOME/Lib/site-packages/sitecustomize.py 内容: import sys sys.setdefaultencoding('utf8') cry wrote: > python,您好! > > 我下了SPE,试了一下,发现对汉字的支持报出错误: > 如果在文件第一行写上: > # -*- coding: utf-8 -*- > 在文件中如果有汉字的话,则保存的时候失败,下部的SHELL中显示: > Traceback (most recent call last): > File "I:\Python24\Lib\site-packages\_spe\Menu.py", line 271, in menu_save > self.app.childActive.save() > File "I:\Python24\Lib\site-packages\_spe\Child.py", line 305, in save > sourceUnicode = source.decode(self.encoding) > File "I:\Python24\lib\encodings\utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-34: invalid data > > > 请问怎么解决呢? > > 谢谢 > > 致 > 礼! > > cry > zyqmail在tom.com > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- _ >` ) - msn: trydofor在hotmail.com ( ( \ - url: www.trydofor.com ---``|\ ---------------------------------------- ___|___ __|___|__ |____ | | | __|___|__ / / |___|___| | | _/ / __/ ---|--- /\ /\ /|\ / \ __/ \____ __/ | \__ ___/ \_
2006年11月22日 星期三 14:25
Spe是什么来的? -----Original Message----- From: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn] On Behalf Of shirj Sent: Wednesday, November 22, 2006 2:03 PM To: python-chinese at lists.python.cn Subject: Re: [python-chinese] SPE and Cchinese words and UTF-8 pythoners, 不知道你的spe是什么版本,我这没有任何问题:) Spe version 0.8.2.a Python version 2.4.2 (2.3 required) wxPython version 2.6.1.0. (2.6.1.0. required) 好像有这么一个文件有必要添加下 位置: $PYTHON_HOME/Lib/site-packages/sitecustomize.py 内容: import sys sys.setdefaultencoding('utf8') cry wrote: > python,您好! > > 我下了SPE,试了一下,发现对汉字的支持报出错误: > 如果在文件第一行写上: > # -*- coding: utf-8 -*- > 在文件中如果有汉字的话,则保存的时候失败,下部的SHELL中显示: > Traceback (most recent call last): > File "I:\Python24\Lib\site-packages\_spe\Menu.py", line 271, in menu_save > self.app.childActive.save() > File "I:\Python24\Lib\site-packages\_spe\Child.py", line 305, in save > sourceUnicode = source.decode(self.encoding) > File "I:\Python24\lib\encodings\utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-34: invalid data > > > 请问怎么解决呢? > > 谢谢 > > 致 > 礼! > > cry > zyqmail at tom.com > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- _ >` ) - msn: trydofor at hotmail.com ( ( \ - url: www.trydofor.com ---``|\ ---------------------------------------- ___|___ __|___|__ |____ | | | __|___|__ / / |___|___| | | _/ / __/ ---|--- /\ /\ /|\ / \ __/ \____ __/ | \__ ___/ \_ _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年11月22日 星期三 14:31
编码有两个地方: 1。代码encoding,只是告诉python,说你的代码是指定的格式。 2。文件encoding,这个才是关键,如果你的文件格式不是utf-8,你的代码指定了,也是没有用。估计你的问题就是第2种。 ----- Original Message ----- From: "cry" <zyqmail在tom.com> To: "python" <python-chinese在lists.python.cn> Sent: Wednesday, November 22, 2006 12:27 PM Subject: [python-chinese] SPE and Cchinese words and UTF-8 > python,您好! > > 我下了SPE,试了一下,发现对汉字的支持报出错误: > 如果在文件第一行写上: > # -*- coding: utf-8 -*- > 在文件中如果有汉字的话,则保存的时候失败,下部的SHELL中显示: > Traceback (most recent call last): > File "I:\Python24\Lib\site-packages\_spe\Menu.py", line 271, in menu_save > self.app.childActive.save() > File "I:\Python24\Lib\site-packages\_spe\Child.py", line 305, in save > sourceUnicode = source.decode(self.encoding) > File "I:\Python24\lib\encodings\utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-34: invalid data > > > 请问怎么解决呢? > > 谢谢 > > 致 > 礼! > > cry > zyqmail在tom.com > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2006年11月22日 星期三 19:10
speÊÇÒ»¸öpythonµÄ±à¼Æ÷ ×Ô¼º·Å¹·²éһϾÍOKÁË¡£ On 11/22/06, NewBoyTim <newboytim在163.com> wrote: > > SpeÊÇʲôÀ´µÄ£¿ > -----Original Message----- > From: python-chinese-bounces在lists.python.cn > [mailto:python-chinese-bounces在lists.python.cn] On Behalf Of shirj > Sent: Wednesday, November 22, 2006 2:03 PM > To: python-chinese在lists.python.cn > Subject: Re: [python-chinese] SPE and Cchinese words and UTF-8 > > pythoners, > > ²»ÖªµÀÄãµÄspeÊÇʲô°æ±¾,ÎÒÕâûÓÐÈκÎÎÊÌâ:) > > Spe version > 0.8.2.a > Python version > 2.4.2 (2.3 required) > wxPython version > 2.6.1.0. (2.6.1.0. required) > > ºÃÏñÓÐÕâôһ¸öÎļþÓбØÒªÌí¼ÓÏ > > λÖÃ: > $PYTHON_HOME/Lib/site-packages/sitecustomize.py > ÄÚÈÝ: > import sys > sys.setdefaultencoding('utf8') > > cry wrote: > > python£¬ÄúºÃ£¡ > > > > ÎÒÏÂÁËSPE£¬ÊÔÁËһϣ¬·¢ÏÖ¶Ôºº×ÖµÄÖ§³Ö±¨³ö´íÎó£º > > Èç¹ûÔÚÎļþµÚÒ»ÐÐдÉÏ£º > > # -*- coding: utf-8 -*- > > ÔÚÎļþÖÐÈç¹ûÓкº×ֵĻ°£¬Ôò±£´æµÄʱºòʧ°Ü£¬Ï²¿µÄSHELLÖÐÏÔʾ£º > > Traceback (most recent call last): > > File "I:\Python24\Lib\site-packages\_spe\Menu.py", line 271, in > menu_save > > self.app.childActive.save() > > File "I:\Python24\Lib\site-packages\_spe\Child.py", line 305, in save > > sourceUnicode = source.decode(self.encoding) > > File "I:\Python24\lib\encodings\utf_8.py", line 16, in decode > > return codecs.utf_8_decode(input, errors, True) > > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 33-34: > invalid data > > > > > > ÇëÎÊÔõô½â¾öÄØ£¿ > > > > лл > > > > Ö > > Àñ£¡ > > > > cry > > zyqmail在tom.com > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > -- > _ > >` ) - msn: trydofor在hotmail.com > ( ( \ - url: www.trydofor.com > ---``|\ ---------------------------------------- > ___|___ __|___|__ |____ > | | | __|___|__ / / > |___|___| | | _/ / > __/ ---|--- /\ > /\ /|\ / \ > __/ \____ __/ | \__ ___/ \_ > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20061122/a62a1839/attachment.html
Zeuux © 2025
京ICP备05028076号