Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

今天用django和qqbot时发现一个sqlite线程冲突问题 #146

Closed
huang1996 opened this issue Apr 18, 2018 · 0 comments
Closed

今天用django和qqbot时发现一个sqlite线程冲突问题 #146

huang1996 opened this issue Apr 18, 2018 · 0 comments

Comments

@huang1996
Copy link

我想着用qqbot做一个上线提醒
报错了
SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 6092 and this is thread id 2700
查了一下,是同时有多个数据库请求,所以冲突了
解决办法:
在contactdb.py里面的ContactDB函数,原代码:

   `self.conn = sqlite3.connect(dbname)`

修改之后

   ` self.conn = sqlite3.connect(dbname,check_same_thread=False)`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant