mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-23 17:31:41 +00:00
parent
5153faf43e
commit
03fac20b1b
@ -5,8 +5,10 @@ import sys
|
||||
|
||||
if sys.version_info.major == 2:
|
||||
from functools32 import lru_cache
|
||||
PY2 = True
|
||||
else:
|
||||
from functools import lru_cache
|
||||
PY2 = False
|
||||
|
||||
SQLITE_ERROR_TEXT = """
|
||||
Couldn't open the wordlist database.
|
||||
@ -20,7 +22,10 @@ This can be configured by setting the WORDFREQ_DATA environment variable.
|
||||
""" % {'path': DB_FILENAME}
|
||||
|
||||
try:
|
||||
if PY2:
|
||||
CONN = sqlite3.connect(DB_FILENAME)
|
||||
else:
|
||||
CONN = sqlite3.connect(DB_FILENAME, check_same_thread=False)
|
||||
except sqlite3.OperationalError:
|
||||
raise IOError(SQLITE_ERROR_TEXT)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user