[Python-bugs-list] [ python-Bugs-513666 ] unicode() docs don't mention LookupError

noreply@sourceforge.net noreply@sourceforge.net
Mon, 08 Jul 2002 22:27:42 -0700


Bugs item #513666, was opened at 2002-02-06 03:52
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=513666&group_id=5470

Category: Documentation
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Ben Gertzfield (che_fox)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: unicode() docs don't mention LookupError

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-07-09 01:27

Message:
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.

----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2002-04-27 11:05

Message:
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.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-03-12 15:25

Message:
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!

----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2002-02-06 04:25

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=513666&group_id=5470