Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>u</code> means those are Unicode strings. They can be encoded to any character set you want:</p> <pre><code>u'http://www.someURL.com'.encode('ascii') # or 'latin-1' or 'utf-8' </code></pre> <p>You'll get back the same string without the <code>u</code> because they're all ASCII characters.</p> <p>See <a href="http://docs.python.org/howto/unicode.html" rel="nofollow">http://docs.python.org/howto/unicode.html</a>.</p> <p>If the strings only contain ASCII characters (all the normal symbols on an English keyboard) then you don't have to worry too much about this. If, however, you're using an extended character set, you need to make sure you're specifying the right encoding when saving strings or displaying them to the user.</p> <p>Edit: When I execute</p> <pre><code>import sqlite3 con = sqlite3.connect(":memory:") con.isolation_level = None c = con.cursor() val1, val2 = 'a', 'b' c.execute('CREATE TABLE IF NOT EXISTS reg(col1 TEXT PRIMARY KEY, col2 TEXT)') c.execute('INSERT INTO reg VALUES(?,?)', (val1, val2)) try: c.execute('INSERT INTO reg VALUES(?,?)', (val1, val2)) except sqlite3.IntegrityError: print val1, "is already in the database" </code></pre> <p>I get <code>a is already in the database</code>. (Note the proper way to do that print statement, although yours is perfectly valid.) So your problem is somewhere else -- <code>locked</code> means something else is writing to the database. Try this with an in memory database as I did, so you know for sure nothing else is accessing it. If this works, your problem is what the exception indicates -- something else is accessing the database.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload