Python 3.0 urllib.parse.parse_qs results in TypeError
Aahz
aahz at pythoncraft.com
Wed Jan 21 10:17:17 EST 2009
In article <313a27f9-c655-4fc4-a8e3-568a4283bba2 at f40g2000pri.googlegroups.com>,
ag73 <andygrove73 at gmail.com> wrote:
>
> form = urllib.parse.parse_qs(qs, keep_blank_values=1)
>
>However, the last line of code that calls parse_qs causes the
>following exception to be thrown:
>
><class 'TypeError'>
>Type str doesn't support the buffer API
One of the key features of Python 3.0 is the fact that it now
distinguishes between bytes and strings. Unfortunately, there are a lot
of ambiguous areas where the correct handling is not clear; for example,
nobody has yet agreed whether URLs are strings or bytes. As you
discovered, forced conversion to string seems to work here and I suggest
you make that your workaround. You could also file a bug on
bugs.python.org (first checking to see whether someone else has already
done so).
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Weinberg's Second Law: If builders built buildings the way programmers wrote
programs, then the first woodpecker that came along would destroy civilization.
More information about the Python-list
mailing list