[New-bugs-announce] [issue2189] urllib.quote() throws KeyError when passed an iterator

djc report at bugs.python.org
Mon Feb 25 13:09:49 CET 2008


New submission from djc:

>>> urllib.quote(['', 'aa'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/urllib.py", line 1205, in quote
    res = map(safe_map.__getitem__, s)
KeyError: ''

I think this is a weird error message to throw. quote() is obviously
assuming that the param passed is a one-character string iterator or
something. It should either accept just strings or come up with a better
error message when confronted with an iterator element that is not a
one-character string, IMO.

----------
components: Library (Lib)
messages: 62978
nosy: djc
severity: minor
status: open
title: urllib.quote() throws KeyError when passed an iterator
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2189>
__________________________________


More information about the New-bugs-announce mailing list