修复再次解密数据库时显示msg.db占用问题

This commit is contained in:
shuaikangzhou
2023-11-29 23:41:02 +08:00
parent a4987a0af1
commit 6c518d3eb8
6 changed files with 60 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
import os.path
import sqlite3
import threading
import time
lock = threading.Lock()
DB = None
@@ -33,7 +34,8 @@ def get_avatar_buffer(userName):
lock.acquire(True)
try:
cursor.execute(sql, [userName])
except AttributeError:
except:
time.sleep(0.5)
init_database()
finally:
cursor.execute(sql, [userName])
@@ -46,5 +48,11 @@ def get_avatar_buffer(userName):
return None
def close():
global DB
if DB:
DB.close()
if __name__ == '__main__':
get_avatar_buffer('wxid_al2oan01b6fn11')