Skip to content

fix: 修复拆分Excel缺少tqdm导入、废弃API及抠图颜色提取引发的程序崩溃问题 - #161

Merged
CoderWanFeng merged 1 commit into
CoderWanFeng:developfrom
Aiky156:fix-high-severity-bugs
Jul 14, 2026
Merged

CoderWanFeng merged 1 commit into
CoderWanFeng:developfrom
Aiky156:fix-high-severity-bugs

Conversation

@Aiky156

@Aiky156 Aiky156 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@Aiky156

Aiky156 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

修复问题说明

针对 ISSUES_AUDIT.md 报告中的高优先级的严重崩溃缺陷进行了修复:

1. 修复了 SplitExcel.py 拆分 Excel 表格时的崩溃问题

  • 补充了缺失的 from tqdm import tqdm 导入,解决 NameError。
  • 替换了已废弃的 API,将 workbook.get_sheet_by_name 替换为 workbook[worksheet_name],解决 AttributeError。
  • 将所有不规范的 except: 替换成了 except Exception as e:,同时在读取 read_only=True 的 xlsx 文件时加入 finally: workbook.close() 确保资源释放。

2. 修复了 eliminate_background.py 抠图功能对不同图片格式的容错问题

  • 取消了对图片格式后缀的硬编码校验。统一进行 img.convert("RGB") 后提取像素,解决处理 .jpeg 等其他格式以及黑白图片时直接解包崩溃的问题。
  • 修复了当输入非法十六进制颜色字符串时 _hex_to_rgb 返回 None 导致的链式崩溃,改为了抛出明确的 ValueError。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants