我想這樣的代碼:Python中的SQLite:數據庫被鎖定
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()
我趕上這個例外:
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
權限cache.db都OK。有任何想法嗎?
問題是,db文件的路徑實際上是安裝了samba的目錄。我感動了它,並開始工作。 – Soid 2010-08-30 06:03:13
如果問題得到解決,請發表解答並回復你自己的問題。 – shkschneider 2012-08-30 14:23:45