我创建了一个 sqlite 数据库并将其上传到主机。
然后我从我的脚本中检索它并尝试插入一些数据,但是 execute() 正在返回一个
DatabaseError (file is encrypted or is not a database).
urllib.urlretrieve('http://%s/%s' % (HOST, NAME_DB), NAME_DB)
con = sqlite3.connect(NAME_DB)
cur = con.cursor()
cur.execute('insert into log(date, count, average) values(date("now"), ?, ?)', (1, 1.2))
con.commit()
con.close()
Traceback (most recent call last):
File "mylog.py", line 17, in <module>
cur.execute('insert into log(date, count, average) values(date("now"), ?, ?)', (1, 1.2))
sqlite3.DatabaseError: file is encrypted or is not a database
如果我使用 sqlite CLI 插入数据,则不会发生此类错误。请你帮助我好吗?