修复NoneType object is not iterable的问题

This commit is contained in:
shuaikangzhou 2024-01-29 21:56:15 +08:00
parent e64af57ca3
commit e1361a6b23
5 changed files with 29 additions and 21 deletions

View File

@ -40,7 +40,7 @@ class MicroMsg:
def get_contact(self): def get_contact(self):
if not self.open_flag: if not self.open_flag:
return None return []
try: try:
lock.acquire(True) lock.acquire(True)
sql = '''SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,COALESCE(ContactLabel.LabelName, 'None') AS labelName sql = '''SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,COALESCE(ContactLabel.LabelName, 'None') AS labelName

View File

@ -1,7 +1,9 @@
import shutil
from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtCore import QThread, pyqtSignal
from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit
from app.DataBase import micro_msg_db, misc_db, msg_db from app.DataBase import micro_msg_db, misc_db, msg_db, close_db
from app.components import ContactQListWidgetItem, ScrollBar from app.components import ContactQListWidgetItem, ScrollBar
from app.person import Contact from app.person import Contact
from app.ui.Icon import Icon from app.ui.Icon import Icon
@ -136,6 +138,15 @@ class ShowContactThread(QThread):
def run(self) -> None: def run(self) -> None:
contact_info_lists = micro_msg_db.get_contact() contact_info_lists = micro_msg_db.get_contact()
if not contact_info_lists:
self.load_finish_signal.emit(True)
# QMessageBox.critical(None, "错误", "数据库错误,请重启电脑后重试")
close_db()
try:
shutil.rmtree('./app/Database/Msg')
except:
pass
return
for contact_info_list in contact_info_lists: for contact_info_list in contact_info_lists:
# UserName, Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl # UserName, Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl
contact_info = { contact_info = {

View File

@ -3,7 +3,7 @@ from typing import List
from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtCore import QThread, pyqtSignal
from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit, QLabel from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit, QLabel
from app.DataBase import micro_msg_db, misc_db from app.DataBase import micro_msg_db, misc_db, close_db
from app.components import ContactQListWidgetItem, ScrollBar from app.components import ContactQListWidgetItem, ScrollBar
from app.person import Contact from app.person import Contact
from app.ui.Icon import Icon from app.ui.Icon import Icon
@ -152,6 +152,16 @@ class ShowContactThread(QThread):
def run(self) -> None: def run(self) -> None:
contact_info_lists = micro_msg_db.get_contact() contact_info_lists = micro_msg_db.get_contact()
if not contact_info_lists:
self.load_finish_signal.emit(True)
# QMessageBox.critical(None, "错误", "数据库错误,请重启电脑后重试")
close_db()
import shutil
try:
shutil.rmtree('./app/Database/Msg')
except:
pass
return
for contact_info_list in contact_info_lists: for contact_info_list in contact_info_lists:
# UserName, Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl,ExtraBuf # UserName, Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl,ExtraBuf
detail = decodeExtraBuf(contact_info_list[9]) detail = decodeExtraBuf(contact_info_list[9])

View File

@ -332,11 +332,14 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif):
try: try:
img_bytes = misc_db.get_avatar_buffer(wxid) img_bytes = misc_db.get_avatar_buffer(wxid)
except: except:
close_db()
logger.error(f'数据库错误:\n{traceback.format_exc()}') logger.error(f'数据库错误:\n{traceback.format_exc()}')
QMessageBox.critical(self, "数据库错误", "请重启微信后重试") QMessageBox.critical(self, "数据库错误", "请重启微信后重试")
close_db()
import shutil import shutil
try:
shutil.rmtree('./app/Database/Msg') shutil.rmtree('./app/Database/Msg')
except:
pass
return return
if not img_bytes: if not img_bytes:
return return

View File

@ -1,16 +0,0 @@
教程参考
[导出聊天记录](https://blog.csdn.net/m0_59452630/article/details/124222235?spm=1001.2014.3001.5501 "一文教会你导出微信聊天记录")
对于模拟器中信息提取如果使用自带的Amaze复制到共享文件夹出现错误无法导入可以使用MT管理器
![image-20231113143254986](..\images\MT)
MT管理器打开界面如下图所示右边打开微信文件存储位置找到MicroMsg左边打开共享文件位置可以通过右边的电脑图案查看路径。
如图长按MicroMsg文件夹弹出弹窗点击复制->确认。
![image-20231111001821854](..\images\cv-opration)
开始复制,稍等一会即可完成复制。
![image-20231111001132681](..\images\cv_process)