self._base_dir = base_dir
self._exclude_dir = exclude_dir
if not os.path.isfile(db_file):
- self._conn = sqlite3.connect(db_file)
+ self._conn = sqlite3.connect(db_file, check_same_thread=False)
self._create_db()
else:
- self._conn = sqlite3.connect(db_file)
+ self._conn = sqlite3.connect(db_file, check_same_thread=False)
logging.info("Opened locator for %s.", self._base_dir)
def locate_file(self, name, size, meta_time):
def _create_db(self):
logging.info("Creating locator database for %s...", self._base_dir)
c = self._conn.cursor()
- c.execute('''CREATE TABLE cache
- (name TEXT, size INTEGER, meta_time INTEGER, file_dir TEXT,
- access_time INTEGER)
- PRIMARY KEY (name, size, meta_time)''')
+ c.execute('''CREATE TABLE cache(
+ name TEXT, size INTEGER, meta_time INTEGER, file_dir TEXT,
+ access_time INTEGER,
+ PRIMARY KEY (name, size, meta_time))''')
self._conn.commit()