From Leeon.Li at ca.com Sun May 31 18:20:57 2009 From: Leeon.Li at ca.com (Li, Leeon) Date: Mon, 1 Jun 2009 02:20:57 +1000 Subject: [I18n-sig] Python3.0.1.1 is not available when system locale is zh_TW.eucTW Message-ID: Dear all, Have you meet a problem that Python3.0.1.1 is not available when system locale is zh_TW.eucTW? I just downloaded Python3.0.1 source code and compiled it on my Debian 5.0 Linux using following commands: root at li-le01-d5:~# ./configure root at li-le01-d5:~# make root at li-le01-d5:~# make altinstall Then I try Python in interactive mod and found the problem. On my system, there is not any output and error message in python3.0 console when I try to execute some statments. See following screen reaction: root at li-le01-d5:~# python3.0 Python 3.0.1 (r301:69556, May 26 2009, 19:48:24) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> loacle.getlocale() >>> help() >>> exit() >>> Then I try to execute a script file hello.py. My script contains only one python statement: print('Hello World!') On my system, there is not any output and error message also when I run "python3.0 hello.py". root at li-le01-d5:~# locale LANG=zh_TW.EUC-TW LC_CTYPE="zh_TW.EUC-TW" LC_NUMERIC="zh_TW.EUC-TW" LC_TIME="zh_TW.EUC-TW" LC_COLLATE="zh_TW.EUC-TW" LC_MONETARY="zh_TW.EUC-TW" LC_MESSAGES="zh_TW.EUC-TW" LC_PAPER="zh_TW.EUC-TW" LC_NAME="zh_TW.EUC-TW" LC_ADDRESS="zh_TW.EUC-TW" LC_TELEPHONE="zh_TW.EUC-TW" LC_MEASUREMENT="zh_TW.EUC-TW" LC_IDENTIFICATION="zh_TW.EUC-TW" LC_ALL= root at li-le01-d5:~# /usr/local/bin/python3.0 hello.py root at li-le01-d5:~# Then I witch to zh_TW.utf8 and try it again. The problem does not occur. root at li-le01-d5:~# LANG=zh_TW.utf8 root at li-le01-d5:~# locale LANG=zh_TW.utf8 LC_CTYPE="zh_TW.utf8" LC_NUMERIC="zh_TW.utf8" LC_TIME="zh_TW.utf8" LC_COLLATE="zh_TW.utf8" LC_MONETARY="zh_TW.utf8" LC_MESSAGES="zh_TW.utf8" LC_PAPER="zh_TW.utf8" LC_NAME="zh_TW.utf8" LC_ADDRESS="zh_TW.utf8" LC_TELEPHONE="zh_TW.utf8" LC_MEASUREMENT="zh_TW.utf8" LC_IDENTIFICATION="zh_TW.utf8" LC_ALL= root at li-le01-d5:~# /usr/local/bin/python3.0 hello.py Hello world! root at li-le01-d5:~# This problem was also occurs when I try the same steps on HP-UX 11.11, SUSE sles10, Ubuntu 9.04. Have you meet the same problem? Would you please kindly to tell me if I missed some steps when I compile Python from source or some env variables from shell or some others. The problem was strange and made me crazy. I am very appreciated if you can tell me how to resolve it. Thank you very much. Leeon -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin at v.loewis.de Sun May 31 20:05:47 2009 From: martin at v.loewis.de (=?GB2312?B?Ik1hcnRpbiB2LiBMbyJ3aXMi?=) Date: Sun, 31 May 2009 20:05:47 +0200 Subject: [I18n-sig] Python3.0.1.1 is not available when system locale is zh_TW.eucTW In-Reply-To: References: Message-ID: <4A22C6FB.6050704@v.loewis.de> > Have you meet the same problem? Would you please kindly to tell me if I > missed some steps when I compile Python from source or some env > variables from shell or some others. You did everything correctly; I can reproduce the problem. The source of the problem is that Python does not support the EUC-TW encoding. Unless a codec for that encoding is contributed, there is no chance to run Python 3 in that locale. Python 3.1 will abort execution with the error message Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: EUC-TW Regards, Martin