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.

Author jpe
Recipients
Date 2004-05-26.14:37:36
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
codecs.lookup raises ValueError when given an empty 
string and UnicodeEncodeError when given a unicode 
object that can't be converted to a str in the default 
encoding.  I'd expect it to raise LookupError when 
passed any basestring instance.

For example:
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC 
v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> import codecs
>>> codecs.lookup('')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "c:\python23\lib\encodings\__init__.py", line 84, in 
search_function
    globals(), locals(), _import_tail)
ValueError: Empty module name
>>> codecs.lookup(u'\uabcd')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode 
character u'\uabcd' in position 0: ordinal not in range
(128)
>>>
History
Date User Action Args
2007-08-23 14:21:52adminlinkissue960874 messages
2007-08-23 14:21:52admincreate