修复再次解密数据库时显示msg.db占用问题
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user