[ python-Bugs-808719 ] IDLE and encodings
SourceForge.net
noreply at sourceforge.net
Thu Aug 12 15:17:35 CEST 2004
Bugs item #808719, was opened at 2003-09-18 19:08
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=808719&group_id=5470
Category: IDLE
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Matthew Cowles (mdcowles)
Assigned to: Martin v. Löwis (loewis)
Summary: IDLE and encodings
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2004-08-12 15:17
Message:
Logged In: YES
user_id=21627
Committed as IOBinding.py 1.24 and 1.19.8.4, NEWS 1.831.4.137.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2004-08-11 07:03
Message:
Logged In: YES
user_id=21627
Looks fine. One day, IDLE should switch to
locale.getpreferredencoding, though.
----------------------------------------------------------------------
Comment By: Kurt B. Kaiser (kbk)
Date: 2004-08-11 04:19
Message:
Logged In: YES
user_id=149084
Martin, do you see any problem if I apply this
patch to IDLE?
----------------------------------------------------------------------
Comment By: Matthew Cowles (mdcowles)
Date: 2003-09-19 19:22
Message:
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.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2003-09-18 20:05
Message:
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?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=808719&group_id=5470
More information about the Python-bugs-list
mailing list