2014-09-24 62 views
-1

我想通過iPython更新sqlite3數據庫。 我可以成功地將數據插入到數據庫中,但是當我嘗試更新一行將返回下面的錯誤對我道:python sqlite3更新語句返回鎖定錯誤

--------------------------------------------------------------------------- 
OperationalError       Traceback (most recent call last) 
<ipython-input-160-6483798c376d> in <module>() 
     2 conn.text_factory = str 
     3 conn.execute("update series set html='test123' where url='https://www.google.com/'") 
----> 4 conn.commit() 
     5 print "Total number of rows updated :", conn.total_changes 

OperationalError: database is locked 

我使用的Python代碼如下。

conn = sqlite3.connect('mydb.db') 
conn.text_factory = str 
conn.execute("update series set html='test123' where url='https://www.google.com/'") 
conn.commit() 
print "Total number of rows updated :", conn.total_changes 

我在做什麼錯?

回答

0

然後我發現通過

fuser mydb.db 

的命令行之前的Python進程有DB鎖定:(

抱歉,讓你忙的人與我的RTFM的東西上