Skip to content

Commit 36431a1

Browse files
committed
Silenced confusing sqlite3.ProgrammingError exception. For more info see: http://twistedmatrix.com/trac/ticket/4040
1 parent 8f7e163 commit 36431a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scrapy/utils/sqlite.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class SqliteDict(DictMixin):
1111
def __init__(self, database=None, table="dict"):
1212
self.database = database or ':memory:'
1313
self.table = table
14-
self.conn = sqlite3.connect(self.database)
14+
# about check_same_thread: http://twistedmatrix.com/trac/ticket/4040
15+
self.conn = sqlite3.connect(self.database, check_same_thread=False)
1516
q = "create table if not exists %s (key text primary key, value blob)" \
1617
% table
1718
self.conn.execute(q)
@@ -91,7 +92,8 @@ class SqlitePriorityQueue(object):
9192
def __init__(self, database=None, table="queue"):
9293
self.database = database or ':memory:'
9394
self.table = table
94-
self.conn = sqlite3.connect(self.database)
95+
# about check_same_thread: http://twistedmatrix.com/trac/ticket/4040
96+
self.conn = sqlite3.connect(self.database, check_same_thread=False)
9597
q = "create table if not exists %s (id integer primary key, " \
9698
"priority real key, message blob)" % table
9799
self.conn.execute(q)

0 commit comments

Comments
 (0)