mirror of
https://github.com/wtc86939209/WeChatMsg110.git
synced 2026-06-14 17:49:11 +08:00
修复第一次启动的显示问题
This commit is contained in:
+16
-1
@@ -13,6 +13,16 @@ if os.path.exists(misc_path):
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def init_database():
|
||||
global DB
|
||||
global cursor
|
||||
if not DB:
|
||||
if os.path.exists(misc_path):
|
||||
DB = sqlite3.connect(misc_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def get_avatar_buffer(userName):
|
||||
sql = '''
|
||||
select smallHeadBuf
|
||||
@@ -21,7 +31,12 @@ def get_avatar_buffer(userName):
|
||||
'''
|
||||
try:
|
||||
lock.acquire(True)
|
||||
cursor.execute(sql, [userName])
|
||||
try:
|
||||
cursor.execute(sql, [userName])
|
||||
except AttributeError:
|
||||
init_database()
|
||||
finally:
|
||||
cursor.execute(sql, [userName])
|
||||
result = cursor.fetchall()
|
||||
# print(result[0][0])
|
||||
if result:
|
||||
|
||||
Reference in New Issue
Block a user