Issue 808719: IDLE and encodings (original) (raw)

A person from Belgium reported this problem in IDLE to python-help:

$ python idle Traceback (most recent call last): File "idle", line 10, in ? import PyShell File "PyShell.py", line 25, in ? from EditorWindow import EditorWindow, fixwordbreaks File "EditorWindow.py", line 39, in ? class EditorWindow: File "EditorWindow.py", line 43, in EditorWindow from IOBinding import IOBinding File "IOBinding.py", line 54, in ? codecs.lookup(encoding) File "/ap/tools/storage/python/v2.2.2.224_ap/lib/python2.2/ encodings/init.py",

line 51, in search_function mod = import(modname,globals(),locals(),'*') ValueError: Empty module name

It seems that checking for an encoding of "" as well as None in IOBinding.py fixes the problem. I'll attach his small patch.

Logged In: YES user_id=198518

The original poster to python-help replies:

SYSTEM: SunOS indsv07 5.6 Generic_105181-19 sun4u sparc SUNW,Ultra-2

????????????????Python2.2??????????????????????????????????????? ????????????

locale.getpreferredencoding Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'getpreferredencoding' locale.getpreferredencoding() Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'getpreferredencoding'

???????????????????????????????????????????????????????????????? ??????

Language: (undefined) Encoding: (undefined)

Locale settings on startup:

LC_NUMERIC ... Language: (undefined) Encoding: (undefined)

LC_MESSAGES ... Language: (undefined) Encoding: (undefined)

LC_MONETARY ... Language: (undefined) Encoding: (undefined)

LC_COLLATE ... Language: (undefined) Encoding: (undefined)

LC_CTYPE ... Language: (undefined) Encoding: (undefined)

LC_TIME ... Language: (undefined) Encoding: (undefined)

Locale settings after calling resetlocale():

LC_NUMERIC ... Language: (undefined) Encoding: (undefined)

LC_MESSAGES ... Language: (undefined) Encoding: (undefined)

LC_MONETARY ... Language: (undefined) Encoding: (undefined)

LC_COLLATE ... Language: (undefined) Encoding: (undefined)

LC_CTYPE ... Language: (undefined) Encoding: (undefined)

LC_TIME ... Language: (undefined) Encoding: (undefined)

Locale settings after calling setlocale(LC_ALL, ""):

C_NUMERIC ... Language: (undefined) Encoding: (undefined)

LC_MESSAGES ... Language: (undefined) Encoding: (undefined)

LC_MONETARY ... Language: (undefined) Encoding: (undefined)

LC_COLLATE ... Language: (undefined) Encoding: (undefined)

LC_CTYPE ... Language: (undefined) Encoding: (undefined)

LC_TIME ... Language: (undefined) Encoding: (undefined)

locale._test() <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 123456789 is 123456789 3.14 is 3.14 locale.getlocale() <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< (None, None) locale.getdefaultlocale() <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< (None, None)

locale.CODESET <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 49

locale.localeconv() <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< {'mon_decimal_point': '', 'int_frac_digits': 127, 'p_sep_by_space': 127, 'frac_digits': 127, 'thousands_sep': '', 'n_sign_posn': 127, 'decimal_point': '.', 'mon_thousands_sep': '', 'n_cs_precedes': 127, 'p_sign_posn': 127, 'int_curr_symbol': '', 'negative_sign': '', 'currency_symbol': '', 'n_sep_by_space': 127, 'mon_grouping': [], 'p_cs_precedes': 127, 'positive_sign': '', 'grouping': []}

locale.getdefaultlocale() <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< < (None, None)

=========================================

====== !!!!!!!!!!!!!!!!!!!!!! Unofficial install of 2.3 (same system) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

=========================================

Python 2.3 (#1, Jul 31 2003, 09:16:42) [GCC 2.95.3 20010315 (release)] on sunos5 Type "help", "copyright", "credits" or "license" for more information.

import locale locale.getpreferredencoding() ''

############# Here, I have done the same modifications in "idlelib...IObinding.py" but for Python 2.3 and I succeed in launching IDLE ######################

Python 2.3 (#1, Jul 31 2003, 09:16:42) [GCC 2.95.3 20010315 (release)] on sunos5 Type "copyright", "credits" or "license()" for more information.



Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface.  This connection is not visible on any external
interface and no data is sent to or received from the Internet.


IDLE 1.0

One last remark, last time I remenber that the problem of codec lookup also appeared in other circumstances than starting IDLE.