2004年03月17日 星期三 14:58
我现在想用wxPython做一些Gui开发工作。 但是wxPython安装后自带的Chm文档是wxWindow的,和Python语法不一样,看起来不方便。 后来又找到“http://www.orbtech.com/www/wx/epydoc/public/wx.py-module.html”这个链接,这里有wxPython的文档,但文档中好象没有例子。 请问大家都看什么wxPython的文档(适合初学的)。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040317/683e7405/attachment.html
2004年03月17日 星期三 15:14
Hello 崔雪松, wxPython 使用的就是 wxWindow 的内核哪?! 不过用wxPython 根本不用看文档的!! 点 Run the wxPython DEMO 的小青蛇! 几乎所有的控件都有示范,而且有对应代码! 看中哪一个复制就可以用了!直观! === [ 14:58 ; 04-03-17 ] you wrote: ? 我现在想用wxPython做一些Gui开发工作。 ? 但是wxPython安装后自带的Chm文档是wxWindow的,和Python语法不一样,看起来不方便。 ? 后来又找到“http://www.orbtech.com/www/wx/epydoc/public/wx.py-module.html”这个链接,这里有wxPython的文档,但文档中好象没有例子。 ? 请问大家都看什么wxPython的文档(适合初学的)。 === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月17日 星期三 15:33
I have no ideas now, the last suggestion: is your codec module for Chinese gb2312 installed correctly? >From: Anthony Liu <antonyliu2002 at yahoo.com> >Reply-To: python-chinese at lists.python.cn >To: pycn <python-chinese at lists.python.cn> >Subject: Re: Re[4]: [python-chinese] cjkcodecs on mandrake, a problem >Date: Tue, 16 Mar 2004 23:28:27 -0800 (PST) > >I've added > >export LANG=zh_CN.GB2312 > >in both .bash_profile and .bashrc > >Now, if I issue 'locale', I get: > >LANG=zh_CN.GB2312 >LC_CTYPE=en_US >LC_NUMERIC=en_US >LC_TIME=en_US >LC_COLLATE=en_US >LC_MONETARY=en_US >LC_MESSAGES=en_US >LC_PAPER=en_US >LC_NAME=en_US >LC_ADDRESS=en_US >LC_TELEPHONE=en_US >LC_MEASUREMENT=en_US >LC_IDENTIFICATION=en_US >LC_ALL= > >Notice that LANG=zh_CN.GB2312, which seems to be what >I want, but still when I run the following script: > >s = '蟒蛇' # s is a string in Chinese >s = unicode(s, 'gb2312') >print s > >I still get the same error message: > >UnicodeEncodeError: 'latin-1' codec can't encode >characters in position 0-1: ordinal not in range(256). > >What should I do? Thank you! > > >--- "Zoom.Quiet" <zoomq at infopro.cn> wrote: > > Hello Anthony, > > > > if define > > # -*- coding: utf-8 -*- > > > > u editor must can import unicode code; > > not like the '蟒蛇' ASII utf-8 encode > > codes!!! > > > > > > === [ 11:18 ; 04-03-17 ] you wrote: > > > > AL> "Zoom.Quiet" <zoomq at itcase.com>, > > zoomq at infopro.cn, > > AL> INVALID_ADDRESS at .SYNTAX-ERROR. > > > > AL> does not work. look at this: > > > > AL> # -*- coding: utf-8 -*- > > > > AL> a = '蟒蛇' > > AL> b = 'abc' > > AL> a = unicode(a, 'utf-8') > > AL> print a > > > > AL> Traceback (most recent call last): > > AL> File "snake.py", line 8, in ? > > AL> a = unicode(a, 'utf-8') > > AL> UnicodeDecodeError: 'utf8' codec can't decode > > bytes in > > AL> position 0-3: invalid data > > > > AL> --- "Zoom.Quiet" <zoomq at infopro.cn> wrote: > > >> Hello Anthony, > > >> > > >> after Python 2.3.x > > >> u can insert line:: > > >> """ > > >> # -*- coding: utf-8 -*- > > >> """ > > >> at script 1st > > >> > > >> to make Python know what encode u will write > > >> > > >> === [ 10:44 ; 04-03-17 ] you wrote: > > >> > > >> AL> Can I just call > > locale.setlocale(locale.LC_ALL, > > >> AL> 'zh_CN') in my python script? > > >> > > >> AL> --- Who Bruce <whoonline at msn.com> wrote: > > >> >> IIRC, ~/.lang > > >> >> edit it > > >> >> set environment LC_LANG and LC_LOCALE and > > other > > >> >> essential evironment. > > >> >> I forget the details,just google it. > > >> >> good luck > > >> >> > > >> >> >From: Anthony Liu <antonyliu2002 at yahoo.com> > > >> >> >Reply-To: python-chinese at lists.python.cn > > >> >> >To: python-chinese at lists.python.cn > > >> >> >Subject: Re: [python-chinese] cjkcodecs on > > >> >> mandrake, a problem > > >> >> >Date: Tue, 16 Mar 2004 18:37:39 -0800 (PST) > > >> >> > > > >> >> >Thanks, Bruce. > > >> >> > > > >> >> >Where is the .lang file? Should I create it > > >> from > > >> >> >scratch? > > >> >> > > > >> >> >And what lines should it contain? > > >> >> > > > >> >> >The env command of the Mandrake shows: > > >> >> > > > >> >> >LANG=en_US > > >> >> > > > >> >> > > > >> >> >--- Who Bruce <whoonline at msn.com> wrote: > > >> >> > > I think you can change your Mandrake's > > local > > >> and > > >> >> > > language setting to > > >> >> > > Chinese. IIRC, change .lang file > > >> >> > > > > >> >> > > > > >> >> > > >From: "Zoom.Quiet" <zoomq at infopro.cn> > > >> >> > > >Reply-To: "Zoom.Quiet" > > <zoomq at itcase.com>, > > >> >> > > zoomq at infopro.cn, > > >> >> > > ,python-chinese at lists.python.cn > > >> >> > > >To: python-chinese at lists.python.cn > > >> >> > > >Subject: Re: [python-chinese] cjkcodecs > > on > > >> >> > > mandrake, a problem > > >> >> > > >Date: Wed, 17 Mar 2004 10:21:21 +0800 > > >> >> > > > > > >> >> > > >Hello Anthony, > > >> >> > > > > > >> >> > > >"'latin-1' codec can't encode" is the > > key! > > >> >> > > >u say:: > > >> >> > > >s = "蟒蛇" # 2 Chinese > > >> characters > > >> AL> for > > >> >> > > > > > >> >> > > >?? > > >> >> > > >but we can see it as chinese! > > >> >> > > >so so means in u sys default location is > > >> >> latin-1!! > > >> >> > > > > > >> >> > > >anything encode as latin-1 ?? > > >> >> > > > > > >> >> > > >so so poor Mandrake..... > > >> >> > > > > > >> >> > > > > > >> >> > > > > > >> >> > > >=== [ 10:12 ; 04-03-17 ] you wrote: > > >> >> > > > > > >> >> > > >AL> The superuser of the Mandrake system > > in > > >> my > > >> >> lab > > >> >> > > >AL> installed cjkcodecs for python. > > >> >> > > > > > >> >> > > >AL> But there is a problem. > > >> >> > > > > > >> >> > > >AL> I can encode english alphabets like > > 'a', > > >> >> 'b', > > >> >> > > 'c' or > > >> >> > > >AL> 'abc' like so: > > >> >> > > > > > >> >> > > >AL> s = 'abc' > > >> >> > > >AL> s = unicode(s, 'gbk') > > >> >> > > >AL> print s # prints 'abc' > > >> >> > > > > > >> >> > > >AL> but when I tried to encode Chinese > > >> strings, > > >> >> I > > >> >> > > have a > > >> >> > > >AL> problem. > > >> >> > > > > > >> >> > > >AL> For example, to run the following > > >> script: > > >> >> > > > > > >> >> > > >AL> s = "蟒蛇" # 2 Chinese > > >> AL> characters > > >> >> >for > > >> >> > > >AL> python > > >> >> > > >AL> s = unicode(s, 'gbk') > > >> >> > > >AL> print s > > >> >> > > > > > >> >> > > >AL> I get the following error message. > > >> >> > > > > > >> >> > > >AL> [antony at ancho tmp]$ python snake.py > > >> >> > > >AL> Traceback (most recent call last): > > >> >> > > >AL> File "snake.py", line 6, in ? > > >> >> > > >AL> print a > > >> >> > > >AL> UnicodeEncodeError: 'latin-1' codec > > >> can't > > >> >> > > encode > > >> >> > > >AL> characters in position 0-1: ordinal > > not > > >> in > > >> >> > > range(256) > > >> >> > > >AL> [antony at ancho tmp]$ > > >> >> > > > > > >> >> > > >AL> What is the problem please? > > >> >> > > > > > >> >> > > > > > >> >> > > >AL> __________________________________ > > >> >> > > >AL> Do you Yahoo!? > > >> >> > > >AL> Yahoo! Mail - More reliable, more > > >> storage, > > >> >> less > > >> >> > > spam > > >> >> > > >AL> http://mail.yahoo.com > > >> >> > > > > > >> >> > > >=== === === === === === === === === === > > >> >> > > > > > >> >> > > >-- > > >> >> > > >Best regards, > > >> >> > > > Zoom.Quiet > > >> >> > > > > > >> >> > > > > > /=======================================\ > > >> >> > > >]Time is unimportant, only life > > important![ > > >> >> > > > > > \=======================================/ > > >> >> > > > > > >> >> > > > > >> >_______________________________________________ > > >> >> > > >python-chinese list > > >> >> > > >python-chinese at lists.python.cn > > >> >> > > > > >> >> > > >http://python.cn/mailman/listinfo/python-chinese > > >> >> > > > > >=== message truncated ===> >_______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > > > >__________________________________ >Do you Yahoo!? >Yahoo! Mail - More reliable, more storage, less spam >http://mail.yahoo.com >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese _________________________________________________________________ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
2004年03月17日 星期三 15:37
I also wanna know that, but, tell you what, I am not the super user, so I don't know if it is installed correctly. But if I can install it under my own home directory and let python know it, then it's also fine with me, but I don't know if this is possible, and how do I let python know where cjkcodecs is? Actually, I guess it is installed OK, because when I encode strings in English using gbk, it works fine. It just does not work for Chinese. Any idea? --- Who Bruce <whoonline at msn.com> wrote: > I have no ideas now, the last suggestion: is your > codec module for Chinese > gb2312 installed correctly? > > >From: Anthony Liu <antonyliu2002 at yahoo.com> > >Reply-To: python-chinese at lists.python.cn > >To: pycn <python-chinese at lists.python.cn> > >Subject: Re: Re[4]: [python-chinese] cjkcodecs on > mandrake, a problem > >Date: Tue, 16 Mar 2004 23:28:27 -0800 (PST) > > > >I've added > > > >export LANG=zh_CN.GB2312 > > > >in both .bash_profile and .bashrc > > > >Now, if I issue 'locale', I get: > > > >LANG=zh_CN.GB2312 > >LC_CTYPE=en_US > >LC_NUMERIC=en_US > >LC_TIME=en_US > >LC_COLLATE=en_US > >LC_MONETARY=en_US > >LC_MESSAGES=en_US > >LC_PAPER=en_US > >LC_NAME=en_US > >LC_ADDRESS=en_US > >LC_TELEPHONE=en_US > >LC_MEASUREMENT=en_US > >LC_IDENTIFICATION=en_US > >LC_ALL= > > > >Notice that LANG=zh_CN.GB2312, which seems to be > what > >I want, but still when I run the following script: > > > >s = 'òþÉß' # s is a string in Chinese > >s = unicode(s, 'gb2312') > >print s > > > >I still get the same error message: > > > >UnicodeEncodeError: 'latin-1' codec can't encode > >characters in position 0-1: ordinal not in > range(256). > > > >What should I do? Thank you! > > > > > >--- "Zoom.Quiet" <zoomq at infopro.cn> wrote: > > > Hello Anthony, > > > > > > if define > > > # -*- coding: utf-8 -*- > > > > > > u editor must can import unicode code; > > > not like the 'òþÉß' ASII utf-8 encode > > > codes!!! > > > > > > > > > === [ 11:18 ; 04-03-17 ] you wrote: > > > > > > AL> "Zoom.Quiet" <zoomq at itcase.com>, > > > zoomq at infopro.cn, > > > AL> INVALID_ADDRESS at .SYNTAX-ERROR. > > > > > > AL> does not work. look at this: > > > > > > AL> # -*- coding: utf-8 -*- > > > > > > AL> a = 'òþÉß' > > > AL> b = 'abc' > > > AL> a = unicode(a, 'utf-8') > > > AL> print a > > > > > > AL> Traceback (most recent call last): > > > AL> File "snake.py", line 8, in ? > > > AL> a = unicode(a, 'utf-8') > > > AL> UnicodeDecodeError: 'utf8' codec can't > decode > > > bytes in > > > AL> position 0-3: invalid data > > > > > > AL> --- "Zoom.Quiet" <zoomq at infopro.cn> wrote: > > > >> Hello Anthony, > > > >> > > > >> after Python 2.3.x > > > >> u can insert line:: > > > >> """ > > > >> # -*- coding: utf-8 -*- > > > >> """ > > > >> at script 1st > > > >> > > > >> to make Python know what encode u will write > > > >> > > > >> === [ 10:44 ; 04-03-17 ] you wrote: > > > >> > > > >> AL> Can I just call > > > locale.setlocale(locale.LC_ALL, > > > >> AL> 'zh_CN') in my python script? > > > >> > > > >> AL> --- Who Bruce <whoonline at msn.com> wrote: > > > >> >> IIRC, ~/.lang > > > >> >> edit it > > > >> >> set environment LC_LANG and LC_LOCALE and > > > other > > > >> >> essential evironment. > > > >> >> I forget the details,just google it. > > > >> >> good luck > > > >> >> > > > >> >> >From: Anthony Liu > <antonyliu2002 at yahoo.com> > > > >> >> >Reply-To: python-chinese at lists.python.cn > > > >> >> >To: python-chinese at lists.python.cn > > > >> >> >Subject: Re: [python-chinese] cjkcodecs > on > > > >> >> mandrake, a problem > > > >> >> >Date: Tue, 16 Mar 2004 18:37:39 -0800 > (PST) > > > >> >> > > > > >> >> >Thanks, Bruce. > > > >> >> > > > > >> >> >Where is the .lang file? Should I create > it > > > >> from > > > >> >> >scratch? > > > >> >> > > > > >> >> >And what lines should it contain? > > > >> >> > > > > >> >> >The env command of the Mandrake shows: > > > >> >> > > > > >> >> >LANG=en_US > > > >> >> > > > > >> >> > > > > >> >> >--- Who Bruce <whoonline at msn.com> wrote: > > > >> >> > > I think you can change your Mandrake's > > > local > > > >> and > > > >> >> > > language setting to > > > >> >> > > Chinese. IIRC, change .lang file > > > >> >> > > > > > >> >> > > > > > >> >> > > >From: "Zoom.Quiet" <zoomq at infopro.cn> > > > >> >> > > >Reply-To: "Zoom.Quiet" > > > <zoomq at itcase.com>, > > > >> >> > > zoomq at infopro.cn, > > > >> >> > > ,python-chinese at lists.python.cn > > > >> >> > > >To: python-chinese at lists.python.cn > > > >> >> > > >Subject: Re: [python-chinese] > cjkcodecs > > > on > > > >> >> > > mandrake, a problem > > > >> >> > > >Date: Wed, 17 Mar 2004 10:21:21 +0800 > > > >> >> > > > > > > >> >> > > >Hello Anthony, > > > >> >> > > > > > > >> >> > > >"'latin-1' codec can't encode" is the > > > key! > > > >> >> > > >u say:: > > > >> >> > > >s = "òþÉß" # 2 Chinese > > > >> characters > > > >> AL> for > > > >> >> > > > > > > >> >> > > >?? > > > >> >> > > >but we can see it as chinese! > > > >> >> > > >so so means in u sys default location > is > > > >> >> latin-1!! > > > >> >> > > > > > > >> >> > > >anything encode as latin-1 ?? > > > >> >> > > > > > > >> >> > > >so so poor Mandrake..... > > > >> >> > > > > > > >> >> > > > > > > >> >> > > > > > > >> >> > > >=== [ 10:12 ; 04-03-17 ] you wrote: > > > >> >> > > > > > > >> >> > > >AL> The superuser of the Mandrake > system > > > in > > > >> my > > > >> >> lab > > > >> >> > > >AL> installed cjkcodecs for python. > > > >> >> > > > > > > >> >> > > >AL> But there is a problem. > > > >> >> > > > > > > >> >> > > >AL> I can encode english alphabets > like > > > 'a', > > > >> >> 'b', > > > >> >> > > 'c' or > > > >> >> > > >AL> 'abc' like so: > > > >> >> > > > > > > >> >> > > >AL> s = 'abc' > > > >> >> > > >AL> s = unicode(s, 'gbk') > > > >> >> > > >AL> print s # prints 'abc' > > > >> >> > > > > > > >> >> > > >AL> but when I tried to encode > Chinese > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam http://mail.yahoo.com
2004年03月17日 星期三 15:55
Hello Anthony, u can not run as root?? this this key infomation! but u can try #!/u/instll/where/CJKPython/python to make sure right version Python to run! and http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=427317&page;=0&view;=collapsed&sb;=5&o;=all&fpart;= is some detail of gbutf encode.... good luck! === [ 15:37 ; 04-03-17 ] you wrote: AL> I also wanna know that, but, tell you what, I am not AL> the super user, so I don't know if it is installed AL> correctly. AL> But if I can install it under my own home directory AL> and let python know it, then it's also fine with me, AL> but I don't know if this is possible, and how do I let AL> python know where cjkcodecs is? AL> Actually, I guess it is installed OK, because when I AL> encode strings in English using gbk, it works fine. AL> It just does not work for Chinese. AL> Any idea? AL> --- Who Bruce <whoonline at msn.com> wrote: >> I have no ideas now, the last suggestion: is your >> codec module for Chinese >> gb2312 installed correctly? >> >> >From: Anthony Liu <antonyliu2002 at yahoo.com> >> >Reply-To: python-chinese at lists.python.cn >> >To: pycn <python-chinese at lists.python.cn> >> >Subject: Re: Re[4]: [python-chinese] cjkcodecs on >> mandrake, a problem >> >Date: Tue, 16 Mar 2004 23:28:27 -0800 (PST) >> > >> >I've added >> > >> >export LANG=zh_CN.GB2312 >> > >> >in both .bash_profile and .bashrc >> > >> >Now, if I issue 'locale', I get: >> > >> >LANG=zh_CN.GB2312 >> >LC_CTYPE=en_US >> >LC_NUMERIC=en_US >> >LC_TIME=en_US >> >LC_COLLATE=en_US >> >LC_MONETARY=en_US >> >LC_MESSAGES=en_US >> >LC_PAPER=en_US >> >LC_NAME=en_US >> >LC_ADDRESS=en_US >> >LC_TELEPHONE=en_US >> >LC_MEASUREMENT=en_US >> >LC_IDENTIFICATION=en_US >> >LC_ALL= >> > >> >Notice that LANG=zh_CN.GB2312, which seems to be >> what >> >I want, but still when I run the following script: >> > >> >s = '蟒蛇' # s is a string in Chinese >> >s = unicode(s, 'gb2312') >> >print s >> > >> >I still get the same error message: >> > >> >UnicodeEncodeError: 'latin-1' codec can't encode >> >characters in position 0-1: ordinal not in >> range(256). >> > >> >What should I do? Thank you! >> > >> > >> >--- "Zoom.Quiet" <zoomq at infopro.cn> wrote: >> > > Hello Anthony, >> > > >> > > if define >> > > # -*- coding: utf-8 -*- >> > > >> > > u editor must can import unicode code; >> > > not like the '蟒蛇' ASII utf-8 encode >> > > codes!!! >> > > >> > > >> > > === [ 11:18 ; 04-03-17 ] you wrote: >> > > >> > > AL> "Zoom.Quiet" <zoomq at itcase.com>, >> > > zoomq at infopro.cn, >> > > AL> INVALID_ADDRESS at .SYNTAX-ERROR. >> > > >> > > AL> does not work. look at this: >> > > >> > > AL> # -*- coding: utf-8 -*- >> > > >> > > AL> a = '蟒蛇' >> > > AL> b = 'abc' >> > > AL> a = unicode(a, 'utf-8') >> > > AL> print a >> > > >> > > AL> Traceback (most recent call last): >> > > AL> File "snake.py", line 8, in ? >> > > AL> a = unicode(a, 'utf-8') >> > > AL> UnicodeDecodeError: 'utf8' codec can't >> decode >> > > bytes in >> > > AL> position 0-3: invalid data >> > > >> > > AL> --- "Zoom.Quiet" <zoomq at infopro.cn> wrote: >> > > >> Hello Anthony, >> > > >> >> > > >> after Python 2.3.x >> > > >> u can insert line:: >> > > >> """ >> > > >> # -*- coding: utf-8 -*- >> > > >> """ >> > > >> at script 1st >> > > >> >> > > >> to make Python know what encode u will write >> > > >> >> > > >> === [ 10:44 ; 04-03-17 ] you wrote: >> > > >> >> > > >> AL> Can I just call >> > > locale.setlocale(locale.LC_ALL, >> > > >> AL> 'zh_CN') in my python script? >> > > >> >> > > >> AL> --- Who Bruce <whoonline at msn.com> wrote: >> > > >> >> IIRC, ~/.lang >> > > >> >> edit it >> > > >> >> set environment LC_LANG and LC_LOCALE and >> > > other >> > > >> >> essential evironment. >> > > >> >> I forget the details,just google it. >> > > >> >> good luck >> > > >> >> >> > > >> >> >From: Anthony Liu >> <antonyliu2002 at yahoo.com> >> > > >> >> >Reply-To: python-chinese at lists.python.cn >> > > >> >> >To: python-chinese at lists.python.cn >> > > >> >> >Subject: Re: [python-chinese] cjkcodecs >> on >> > > >> >> mandrake, a problem >> > > >> >> >Date: Tue, 16 Mar 2004 18:37:39 -0800 >> (PST) >> > > >> >> > >> > > >> >> >Thanks, Bruce. >> > > >> >> > >> > > >> >> >Where is the .lang file? Should I create >> it >> > > >> from >> > > >> >> >scratch? >> > > >> >> > >> > > >> >> >And what lines should it contain? >> > > >> >> > >> > > >> >> >The env command of the Mandrake shows: >> > > >> >> > >> > > >> >> >LANG=en_US >> > > >> >> > >> > > >> >> > >> > > >> >> >--- Who Bruce <whoonline at msn.com> wrote: >> > > >> >> > > I think you can change your Mandrake's >> > > local >> > > >> and >> > > >> >> > > language setting to >> > > >> >> > > Chinese. IIRC, change .lang file >> > > >> >> > > >> > > >> >> > > >> > > >> >> > > >From: "Zoom.Quiet" <zoomq at infopro.cn> >> > > >> >> > > >Reply-To: "Zoom.Quiet" >> > > <zoomq at itcase.com>, >> > > >> >> > > zoomq at infopro.cn, >> > > >> >> > > ,python-chinese at lists.python.cn >> > > >> >> > > >To: python-chinese at lists.python.cn >> > > >> >> > > >Subject: Re: [python-chinese] >> cjkcodecs >> > > on >> > > >> >> > > mandrake, a problem >> > > >> >> > > >Date: Wed, 17 Mar 2004 10:21:21 +0800 >> > > >> >> > > > >> > > >> >> > > >Hello Anthony, >> > > >> >> > > > >> > > >> >> > > >"'latin-1' codec can't encode" is the >> > > key! >> > > >> >> > > >u say:: >> > > >> >> > > >s = "蟒蛇" # 2 Chinese >> > > >> characters >> > > >> AL> for >> > > >> >> > > > >> > > >> >> > > >?? >> > > >> >> > > >but we can see it as chinese! >> > > >> >> > > >so so means in u sys default location >> is >> > > >> >> latin-1!! >> > > >> >> > > > >> > > >> >> > > >anything encode as latin-1 ?? >> > > >> >> > > > >> > > >> >> > > >so so poor Mandrake..... >> > > >> >> > > > >> > > >> >> > > > >> > > >> >> > > > >> > > >> >> > > >=== [ 10:12 ; 04-03-17 ] you wrote: >> > > >> >> > > > >> > > >> >> > > >AL> The superuser of the Mandrake >> system >> > > in >> > > >> my >> > > >> >> lab >> > > >> >> > > >AL> installed cjkcodecs for python. >> > > >> >> > > > >> > > >> >> > > >AL> But there is a problem. >> > > >> >> > > > >> > > >> >> > > >AL> I can encode english alphabets >> like >> > > 'a', >> > > >> >> 'b', >> > > >> >> > > 'c' or >> > > >> >> > > >AL> 'abc' like so: >> > > >> >> > > > >> > > >> >> > > >AL> s = 'abc' >> > > >> >> > > >AL> s = unicode(s, 'gbk') >> > > >> >> > > >AL> print s # prints 'abc' >> > > >> >> > > > >> > > >> >> > > >AL> but when I tried to encode >> Chinese >> AL> === message truncated === AL> __________________________________ AL> Do you Yahoo!? AL> Yahoo! Mail - More reliable, more storage, less spam AL> http://mail.yahoo.com === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月17日 星期三 16:19
> #!/u/instll/where/CJKPython/python What do you mean by that line? Do you mean the path of the cjkcodecs? On the Mandrake system in my lab, I have cjkcodecs under my home directory like so: /export/home/antony/nlp/cjkcodecs-1.0.3/cjkcodecs I issued a command like the one you gave, it does not work. --- "Zoom.Quiet" <zoomq at infopro.cn> wrote: > Hello Anthony, > > u can not run as root?? > > this this key infomation! > > but u can try > #!/u/instll/where/CJKPython/python > > to make sure right version Python to run! > > and > http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=427317&page;=0&view;=collapsed&sb;=5&o;=all&fpart;= > > is some detail of gbutf encode.... > > good luck! > > === [ 15:37 ; 04-03-17 ] you wrote: > > AL> I also wanna know that, but, tell you what, I am > not > AL> the super user, so I don't know if it is > installed > AL> correctly. > > AL> But if I can install it under my own home > directory > AL> and let python know it, then it's also fine with > me, > AL> but I don't know if this is possible, and how do > I let > AL> python know where cjkcodecs is? > > AL> Actually, I guess it is installed OK, because > when I > AL> encode strings in English using gbk, it works > fine. > AL> It just does not work for Chinese. > > AL> Any idea? > > AL> --- Who Bruce <whoonline at msn.com> wrote: > >> I have no ideas now, the last suggestion: is your > >> codec module for Chinese > >> gb2312 installed correctly? > >> > >> >From: Anthony Liu <antonyliu2002 at yahoo.com> > >> >Reply-To: python-chinese at lists.python.cn > >> >To: pycn <python-chinese at lists.python.cn> > >> >Subject: Re: Re[4]: [python-chinese] cjkcodecs > on > >> mandrake, a problem > >> >Date: Tue, 16 Mar 2004 23:28:27 -0800 (PST) > >> > > >> >I've added > >> > > >> >export LANG=zh_CN.GB2312 > >> > > >> >in both .bash_profile and .bashrc > >> > > >> >Now, if I issue 'locale', I get: > >> > > >> >LANG=zh_CN.GB2312 > >> >LC_CTYPE=en_US > >> >LC_NUMERIC=en_US > >> >LC_TIME=en_US > >> >LC_COLLATE=en_US > >> >LC_MONETARY=en_US > >> >LC_MESSAGES=en_US > >> >LC_PAPER=en_US > >> >LC_NAME=en_US > >> >LC_ADDRESS=en_US > >> >LC_TELEPHONE=en_US > >> >LC_MEASUREMENT=en_US > >> >LC_IDENTIFICATION=en_US > >> >LC_ALL= > >> > > >> >Notice that LANG=zh_CN.GB2312, which seems to be > >> what > >> >I want, but still when I run the following > script: > >> > > >> >s = '蟒蛇' # s is a string in Chinese > >> >s = unicode(s, 'gb2312') > >> >print s > >> > > >> >I still get the same error message: > >> > > >> >UnicodeEncodeError: 'latin-1' codec can't encode > >> >characters in position 0-1: ordinal not in > >> range(256). > >> > > >> >What should I do? Thank you! > >> > > >> > > >> >--- "Zoom.Quiet" <zoomq at infopro.cn> wrote: > >> > > Hello Anthony, > >> > > > >> > > if define > >> > > # -*- coding: utf-8 -*- > >> > > > >> > > u editor must can import unicode code; > >> > > not like the '蟒蛇' ASII utf-8 encode > >> > > codes!!! > >> > > > >> > > > >> > > === [ 11:18 ; 04-03-17 ] you wrote: > >> > > > >> > > AL> "Zoom.Quiet" <zoomq at itcase.com>, > >> > > zoomq at infopro.cn, > >> > > AL> INVALID_ADDRESS at .SYNTAX-ERROR. > >> > > > >> > > AL> does not work. look at this: > >> > > > >> > > AL> # -*- coding: utf-8 -*- > >> > > > >> > > AL> a = '蟒蛇' > >> > > AL> b = 'abc' > >> > > AL> a = unicode(a, 'utf-8') > >> > > AL> print a > >> > > > >> > > AL> Traceback (most recent call last): > >> > > AL> File "snake.py", line 8, in ? > >> > > AL> a = unicode(a, 'utf-8') > >> > > AL> UnicodeDecodeError: 'utf8' codec can't > >> decode > >> > > bytes in > >> > > AL> position 0-3: invalid data > >> > > > >> > > AL> --- "Zoom.Quiet" <zoomq at infopro.cn> > wrote: > >> > > >> Hello Anthony, > >> > > >> > >> > > >> after Python 2.3.x > >> > > >> u can insert line:: > >> > > >> """ > >> > > >> # -*- coding: utf-8 -*- > >> > > >> """ > >> > > >> at script 1st > >> > > >> > >> > > >> to make Python know what encode u will > write > >> > > >> > >> > > >> === [ 10:44 ; 04-03-17 ] you wrote: > >> > > >> > >> > > >> AL> Can I just call > >> > > locale.setlocale(locale.LC_ALL, > >> > > >> AL> 'zh_CN') in my python script? > >> > > >> > >> > > >> AL> --- Who Bruce <whoonline at msn.com> > wrote: > >> > > >> >> IIRC, ~/.lang > >> > > >> >> edit it > >> > > >> >> set environment LC_LANG and LC_LOCALE > and > >> > > other > >> > > >> >> essential evironment. > >> > > >> >> I forget the details,just google it. > >> > > >> >> good luck > >> > > >> >> > >> > > >> >> >From: Anthony Liu > >> <antonyliu2002 at yahoo.com> > >> > > >> >> >Reply-To: > python-chinese at lists.python.cn > >> > > >> >> >To: python-chinese at lists.python.cn > >> > > >> >> >Subject: Re: [python-chinese] > cjkcodecs > >> on > >> > > >> >> mandrake, a problem > >> > > >> >> >Date: Tue, 16 Mar 2004 18:37:39 -0800 > >> (PST) > >> > > >> >> > > >> > > >> >> >Thanks, Bruce. > >> > > >> >> > > >> > > >> >> >Where is the .lang file? Should I > create > >> it > >> > > >> from > >> > > >> >> >scratch? > >> > > >> >> > > >> > > >> >> >And what lines should it contain? > >> > > >> >> > > >> > > >> >> >The env command of the Mandrake shows: > >> > > >> >> > > >> > > >> >> >LANG=en_US > >> > > >> >> > > >> > > >> >> > > >> > > >> >> >--- Who Bruce <whoonline at msn.com> > wrote: > >> > > >> >> > > I think you can change your > Mandrake's > >> > > local > >> > > >> and > >> > > >> >> > > language setting to > >> > > >> >> > > Chinese. IIRC, change .lang file > >> > > >> >> > > > >> > > >> >> > > > >> > > >> >> > > >From: "Zoom.Quiet" > <zoomq at infopro.cn> > >> > > >> >> > > >Reply-To: "Zoom.Quiet" > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam http://mail.yahoo.com
2004年03月17日 星期三 16:38
Hello Anthony, sorry ! i meane path to u right python! in win32 CJKPython2.3.3.exe is one full Python packet ,include one Python 2.3.3+cjkcodecs-1.0.3+iconvcodec-1.1.2.win32-py2.3 so so run python can get: Python 2.3.3 (CJK/SJIS) (#51, Feb 13 2004, 22:04:56) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> so so >> #!/u/instll/where/CJKPython/python the path must u right Python had patch as cjkcodecs-1.0.3.tar.gz can run it get some info. like up === [ 16:19 ; 04-03-17 ] you wrote: >> #!/u/instll/where/CJKPython/python AL> What do you mean by that line? Do you mean the path AL> of the cjkcodecs? On the Mandrake system in my lab, I AL> have cjkcodecs under my home directory like so: AL> /export/home/antony/nlp/cjkcodecs-1.0.3/cjkcodecs AL> I issued a command like the one you gave, it does not AL> work. AL> --- "Zoom.Quiet" <zoomq at infopro.cn> wrote: >> Hello Anthony, >> >> u can not run as root?? >> >> this this key infomation! >> >> but u can try >> #!/u/instll/where/CJKPython/python >> >> to make sure right version Python to run! >> >> and >> AL> http://www.linuxforum.net/forum/gshowflat.php?Cat=&Board;=python&Number;=427317&page;=0&view;=collapsed&sb;=5&o;=all&fpart;= >> >> is some detail of gbutf encode.... >> >> good luck! >> >> === [ 15:37 ; 04-03-17 ] you wrote: >> >> AL> I also wanna know that, but, tell you what, I am >> not >> AL> the super user, so I don't know if it is >> installed >> AL> correctly. >> >> AL> But if I can install it under my own home >> directory >> AL> and let python know it, then it's also fine with >> me, >> AL> but I don't know if this is possible, and how do >> I let >> AL> python know where cjkcodecs is? >> >> AL> Actually, I guess it is installed OK, because >> when I >> AL> encode strings in English using gbk, it works >> fine. >> AL> It just does not work for Chinese. >> >> AL> Any idea? >> >> AL> --- Who Bruce <whoonline at msn.com> wrote: >> >> I have no ideas now, the last suggestion: is your >> >> codec module for Chinese >> >> gb2312 installed correctly? >> >> >> >> >From: Anthony Liu <antonyliu2002 at yahoo.com> >> >> >Reply-To: python-chinese at lists.python.cn >> >> >To: pycn <python-chinese at lists.python.cn> >> >> >Subject: Re: Re[4]: [python-chinese] cjkcodecs >> on >> >> mandrake, a problem >> >> >Date: Tue, 16 Mar 2004 23:28:27 -0800 (PST) >> >> > >> >> >I've added >> >> > >> >> >export LANG=zh_CN.GB2312 >> >> > >> >> >in both .bash_profile and .bashrc >> >> > >> >> >Now, if I issue 'locale', I get: >> >> > >> >> >LANG=zh_CN.GB2312 >> >> >LC_CTYPE=en_US >> >> >LC_NUMERIC=en_US >> >> >LC_TIME=en_US >> >> >LC_COLLATE=en_US >> >> >LC_MONETARY=en_US >> >> >LC_MESSAGES=en_US >> >> >LC_PAPER=en_US >> >> >LC_NAME=en_US >> >> >LC_ADDRESS=en_US >> >> >LC_TELEPHONE=en_US >> >> >LC_MEASUREMENT=en_US >> >> >LC_IDENTIFICATION=en_US >> >> >LC_ALL= >> >> > >> >> >Notice that LANG=zh_CN.GB2312, which seems to be >> >> what >> >> >I want, but still when I run the following >> script: >> >> > >> >> >s = '蟒蛇' # s is a string in AL> Chinese >> >> >s = unicode(s, 'gb2312') >> >> >print s >> >> > >> >> >I still get the same error message: >> >> > >> >> >UnicodeEncodeError: 'latin-1' codec can't encode >> >> >characters in position 0-1: ordinal not in >> >> range(256). >> >> > >> >> >What should I do? Thank you! >> >> > >> >> > >> >> >--- "Zoom.Quiet" <zoomq at infopro.cn> wrote: >> >> > > Hello Anthony, >> >> > > >> >> > > if define >> >> > > # -*- coding: utf-8 -*- >> >> > > >> >> > > u editor must can import unicode code; >> >> > > not like the '蟒蛇' ASII utf-8 AL> encode >> >> > > codes!!! >> >> > > >> >> > > >> >> > > === [ 11:18 ; 04-03-17 ] you wrote: >> >> > > >> >> > > AL> "Zoom.Quiet" <zoomq at itcase.com>, >> >> > > zoomq at infopro.cn, >> >> > > AL> INVALID_ADDRESS at .SYNTAX-ERROR. >> >> > > >> >> > > AL> does not work. look at this: >> >> > > >> >> > > AL> # -*- coding: utf-8 -*- >> >> > > >> >> > > AL> a = '蟒蛇' >> >> > > AL> b = 'abc' >> >> > > AL> a = unicode(a, 'utf-8') >> >> > > AL> print a >> >> > > >> >> > > AL> Traceback (most recent call last): >> >> > > AL> File "snake.py", line 8, in ? >> >> > > AL> a = unicode(a, 'utf-8') >> >> > > AL> UnicodeDecodeError: 'utf8' codec can't >> >> decode >> >> > > bytes in >> >> > > AL> position 0-3: invalid data >> >> > > >> >> > > AL> --- "Zoom.Quiet" <zoomq at infopro.cn> >> wrote: >> >> > > >> Hello Anthony, >> >> > > >> >> >> > > >> after Python 2.3.x >> >> > > >> u can insert line:: >> >> > > >> """ >> >> > > >> # -*- coding: utf-8 -*- >> >> > > >> """ >> >> > > >> at script 1st >> >> > > >> >> >> > > >> to make Python know what encode u will >> write >> >> > > >> >> >> > > >> === [ 10:44 ; 04-03-17 ] you wrote: >> >> > > >> >> >> > > >> AL> Can I just call >> >> > > locale.setlocale(locale.LC_ALL, >> >> > > >> AL> 'zh_CN') in my python script? >> >> > > >> >> >> > > >> AL> --- Who Bruce <whoonline at msn.com> >> wrote: >> >> > > >> >> IIRC, ~/.lang >> >> > > >> >> edit it >> >> > > >> >> set environment LC_LANG and LC_LOCALE >> and >> >> > > other >> >> > > >> >> essential evironment. >> >> > > >> >> I forget the details,just google it. >> >> > > >> >> good luck >> >> > > >> >> >> >> > > >> >> >From: Anthony Liu >> >> <antonyliu2002 at yahoo.com> >> >> > > >> >> >Reply-To: >> python-chinese at lists.python.cn >> >> > > >> >> >To: python-chinese at lists.python.cn >> >> > > >> >> >Subject: Re: [python-chinese] >> cjkcodecs >> >> on >> >> > > >> >> mandrake, a problem >> >> > > >> >> >Date: Tue, 16 Mar 2004 18:37:39 -0800 >> >> (PST) >> >> > > >> >> > >> >> > > >> >> >Thanks, Bruce. >> >> > > >> >> > >> >> > > >> >> >Where is the .lang file? Should I >> create >> >> it >> >> > > >> from >> >> > > >> >> >scratch? >> >> > > >> >> > >> >> > > >> >> >And what lines should it contain? >> >> > > >> >> > >> >> > > >> >> >The env command of the Mandrake shows: >> >> > > >> >> > >> >> > > >> >> >LANG=en_US >> >> > > >> >> > >> >> > > >> >> > >> >> > > >> >> >--- Who Bruce <whoonline at msn.com> >> wrote: >> >> > > >> >> > > I think you can change your >> Mandrake's >> >> > > local >> >> > > >> and >> >> > > >> >> > > language setting to >> >> > > >> >> > > Chinese. IIRC, change .lang file >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >From: "Zoom.Quiet" >> <zoomq at infopro.cn> >> >> > > >> >> > > >Reply-To: "Zoom.Quiet" >> AL> === message truncated === AL> __________________________________ AL> Do you Yahoo!? AL> Yahoo! Mail - More reliable, more storage, less spam AL> http://mail.yahoo.com === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
Zeuux © 2024
京ICP备05028076号