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: unicode() docs don't mention LookupError
Type: Stage:
Components: Documentation Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fdrake Nosy List: che_fox, fdrake, lemburg
Priority: normal Keywords:

Created on 2002-02-06 08:52 by che_fox, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (5)
msg9143 - (view) Author: Ben Gertzfield (che_fox) (Python triager) Date: 2002-02-06 08:52
The unicode() docs say:

"If errors is 'strict' (the default), a ValueError is
raised on errors..."

This is not true; ValueError is only raised on
conversion errors.  There are other exceptions that can
be raised:

Python 2.1.2 (#1, Jan 18 2002, 18:05:45) 
[GCC 2.95.4  (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more
information.

>>> unicode("abc", "nonexistent codec")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
LookupError: unknown encoding

Looking at src/Objects/unicodeobject.c, there are lots
of other exceptions that can be raised.  The
documentation should probably be clarified.
msg9144 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2002-02-06 09:25
Logged In: YES 
user_id=38388

You are right in that there are many more exceptions which are possible (perhaps we ought to mention 
LookupError in the docs), ValueError will certainly be the most common, though.
msg9145 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-03-12 20:25
Logged In: YES 
user_id=3066

Marc-Andre -- could you summarize all the exceptions that
can be raised and what they mean?  A simple list here would
be fine; I can move the information into LaTeX if you'd prefer.

Thanks!
msg9146 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2002-04-27 15:05
Logged In: YES 
user_id=38388

I don't have time for this. The basic errors that I can
currently remember are LookupError (codec not found) and
UnicodeError (invalid data, subclass of ValueError).

Codecs may raise other exceptions as well, so its not
possible to define an exhaustive list.

Assigning back to you, Fred.
msg9147 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-07-09 05:27
Logged In: YES 
user_id=3066

Added a note about unicode() and LookupError in
Doc/lib/libfuncs.tex 1.111 and 1.100.4.6.
History
Date User Action Args
2022-04-10 16:04:57adminsetgithub: 36034
2002-02-06 08:52:47che_foxcreate