This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE and encodings
Type: Stage:
Components: IDLE Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: kbk, loewis, mdcowles
Priority: normal Keywords:

Created on 2003-09-18 17:08 by mdcowles, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
idle.patch mdcowles, 2003-09-18 17:08 Patch
Messages (6)
msg18213 - (view) Author: Matthew Cowles (mdcowles) Date: 2003-09-18 17:08
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.
msg18214 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-09-18 18:05
Logged In: YES 
user_id=21627

Can you report what operating system this was on, and what
locale setting was in place?

What is the value of locale.getpreferredencoding on that system?
msg18215 - (view) Author: Matthew Cowles (mdcowles) Date: 2003-09-19 17:22
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 "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 
'getpreferredencoding'
>>> locale.getpreferredencoding()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 
'getpreferredencoding'
>>>
????????????????????????????????????????????????????????????????
??????


ActivePython 2.2.2 Build 224 (ActiveState Corp.) based on
Python 2.2.2 (#1, Nov 26 2002, 10:37:00)
[GCC 2.95.2 19991024 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for more 
information.
>>>
>>> locale._print_locale()
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<
Locale defaults as determined by getdefaultlocale():
------------------------------------------------------------------------
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.

msg18216 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-08-11 02:19
Logged In: YES 
user_id=149084

Martin, do you see any problem if I apply this
patch to IDLE?
msg18217 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-11 05:03
Logged In: YES 
user_id=21627

Looks fine. One day, IDLE should switch to
locale.getpreferredencoding, though.
msg18218 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-12 13:17
Logged In: YES 
user_id=21627

Committed as IOBinding.py 1.24 and 1.19.8.4, NEWS 1.831.4.137.
History
Date User Action Args
2022-04-10 16:11:13adminsetgithub: 39255
2003-09-18 17:08:35mdcowlescreate