On Tue, Jan 19, 2010 at 7:50 AM, Gnarlodious <gnarlodi...@gmail.com> wrote:

> I am using Python 3, getting an error from SQLite:
>
> sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless
> you use a text_factory that can interpret 8-bit bytestrings (like
> text_factory = str). It is highly recommended that you instead just
> switch your application to Unicode strings.
>
> So... how do I switch to Unicode? I thought I was doing it when I put

# coding:utf-8
>
> at the start of my script.
>

All that does is mean that the script itself is encoded as utf8.

In Py3, anything you do "this" or use str(), you are using unicode strings.

The problem appears to be that you are passing bytestrings to sqlite; things
created with b"this" or bytes(), or read from a file as bytes and not
decoded before passing it to the database.

To really help further, you should provide the line that threw that warning
and show where any variables in it come from. As for that error message, I
believe it means text_factory = bytes.

--S
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to