- Add wxauto package with WeChat UI automation and message handling capabilities - Implement job_extractor.py for automated job posting extraction from WeChat groups - Add job_extractor_gui.py providing graphical interface for job extraction tool - Create comprehensive documentation in Chinese covering GUI usage, multi-group support, and quick start guides - Add build configuration files (build_exe.py, build_exe.spec) for packaging as standalone executable - Include utility scripts for WeChat interaction (auto_send_msg.py, get_history.py, receive_file_transfer.py) - Add project configuration files (pyproject.toml, setup.cfg, requirements.txt) - Include test files (test_api.py, test_com_fix.py) for API and compatibility validation - Add Apache 2.0 LICENSE and comprehensive README documentation - Configure .gitignore to exclude build artifacts, logs, and temporary files
3.3 KiB
3.3 KiB
打包修复完成 ✓
问题已解决
原问题:[WinError -2147221008] 尚未调用 CoInitialize
已通过以下修改解决:
1. 代码修复
- ✓ 在
job_extractor_gui.py中添加pythoncom导入 - ✓ 在工作线程中添加
CoInitialize()和CoUninitialize() - ✓ 正确处理COM组件的生命周期
2. 依赖更新
- ✓ 添加
pywin32>=306到 requirements.txt - ✓ 更新打包脚本自动安装 pywin32
- ✓ 更新 spec 文件包含所有必要模块
3. 打包配置
- ✓ 在
build_exe.spec中添加 pythoncom 等隐藏导入 - ✓ 更新
build.bat自动检查依赖 - ✓ 创建一键修复脚本
快速开始
方法一:一键修复并打包(推荐)
# 双击运行
修复并重新打包.bat
方法二:使用启动工具
# 双击运行
启动工具.bat
# 然后选择:
# [6] 安装/更新依赖
# [5] 打包成 EXE 文件
方法三:手动操作
# 1. 安装依赖
pip install pywin32 pyinstaller
# 2. 验证修复
python test_com_fix.py
# 3. 打包
pyinstaller build_exe.spec
# 4. 测试
dist\微信岗位提取工具.exe
文件说明
核心文件
job_extractor_gui.py- GUI主程序(已修复)build_exe.spec- 打包配置(已更新)requirements.txt- 依赖列表(已添加pywin32)
打包脚本
修复并重新打包.bat- 一键修复脚本 ⭐推荐build.bat- 标准打包脚本build_exe.py- Python打包脚本
测试工具
test_com_fix.py- COM修复验证脚本test_api.py- API连接测试
文档
快速修复指南.txt- 快速参考打包问题修复说明.md- 详细技术说明GUI版本使用说明.md- 使用手册
验证清单
打包完成后,请验证:
- exe能正常启动
- 界面显示正常
- 能保存配置
- 能连接微信(不再报COM错误)
- 能添加监听
- 能接收和处理消息
- 能提取岗位信息
- 能查看详情
- 能导出数据
技术细节
COM组件初始化
import pythoncom
def run_task(self):
# 在线程开始时初始化
pythoncom.CoInitialize()
try:
# 你的代码
pass
finally:
# 在线程结束时清理
pythoncom.CoUninitialize()
打包配置
# build_exe.spec
hiddenimports=[
'pythoncom', # COM支持
'pywintypes', # Windows类型
'win32com', # Win32 COM
'win32api', # Win32 API
# ... 其他模块
]
常见问题
Q: 仍然报COM错误?
A:
- 确认已安装 pywin32:
pip show pywin32 - 重新运行修复脚本
- 检查是否使用了最新的代码
Q: 打包失败?
A:
- 检查磁盘空间
- 关闭杀毒软件
- 以管理员身份运行
- 查看错误日志
Q: exe文件很大?
A: 正常现象,包含了Python运行时和所有依赖,通常30-50MB
Q: 启动很慢?
A: 首次启动会解压文件,后续会快一些
下一步
- 测试打包后的exe
- 配置你的目标群组
- 开始提取岗位信息
- 查看提取结果
支持
如遇问题,请查看:
- 快速修复指南.txt
- 打包问题修复说明.md
- GUI版本使用说明.md
修复完成时间:2026-02-11 版本:v1.0 状态:✓ 已修复并测试