Python SQLite: database is locked

Posted by user322683 on Stack Overflow See other posts from Stack Overflow or by user322683
Published on 2010-04-29T21:12:15Z Indexed on 2010/04/29 21:17 UTC
Read the original article Hit count: 425

Filed under:
|
|

I'm trying this code:

import sqlite

connection = sqlite.connect('cache.db')
cur = connection.cursor()
cur.execute('''create table item
  (id integer primary key, itemno text unique,
        scancode text, descr text, price real)''')

connection.commit()
cur.close()

I'm catching this exception:

Traceback (most recent call last):
  File "cache_storage.py", line 7, in <module>
    scancode text, descr text, price real)''')
  File "/usr/lib/python2.6/dist-packages/sqlite/main.py", line 237, in execute
    self.con._begin()
  File "/usr/lib/python2.6/dist-packages/sqlite/main.py", line 503, in _begin
    self.db.execute("BEGIN")
_sqlite.OperationalError: database is locked

Permissions for cache.db are ok. Any ideas?

© Stack Overflow or respective owner

Related posts about python

Related posts about sqlite