日志: 处理中的文件名显示完整后缀

This commit is contained in:
HONOR
2026-09-20 10:58:12 +08:00
parent 4a7e170e6a
commit c4a24790d6
+6 -5
View File
@@ -454,13 +454,14 @@ class BatchTableExtractorApp:
self.root.after(0, lambda: self.log("\n❌ 任务已被用户手动终止!")) self.root.after(0, lambda: self.log("\n❌ 任务已被用户手动终止!"))
break break
base_name = os.path.splitext(os.path.basename(file_path))[0] full_name = os.path.basename(file_path)
base_name = os.path.splitext(full_name)[0]
target_excel = os.path.join(out_dir, f"{base_name}_表格.xlsx") target_excel = os.path.join(out_dir, f"{base_name}_表格.xlsx")
conflict_action = self.conflict_action_var.get() conflict_action = self.conflict_action_var.get()
if os.path.exists(target_excel): if os.path.exists(target_excel):
if conflict_action == "直接跳过": if conflict_action == "直接跳过":
self.root.after(0, lambda i=idx, t=total, name=base_name: self.log(f"[{i}/{t}] 跳过同名: {name}")) self.root.after(0, lambda i=idx, t=total, name=full_name: self.log(f"[{i}/{t}] 跳过同名: {name}"))
record_log(batch_id, "跳过", base_name, "-", 0, 0.0, file_path, "发现同名文件,跳过") record_log(batch_id, "跳过", base_name, "-", 0, 0.0, file_path, "发现同名文件,跳过")
def update_skip_btn(i=idx, t=total): def update_skip_btn(i=idx, t=total):
self.btn_run.config_btn(text=f"提取中 {i}/{t} | 点击终止操作") self.btn_run.config_btn(text=f"提取中 {i}/{t} | 点击终止操作")
@@ -476,7 +477,7 @@ class BatchTableExtractorApp:
break break
counter += 1 counter += 1
self.root.after(0, lambda i=idx, t=total, name=base_name: self.log(f"[{i}/{t}] 处理中: {name}")) self.root.after(0, lambda i=idx, t=total, name=full_name: self.log(f"[{i}/{t}] 处理中: {name}"))
import time import time
t0 = time.time() t0 = time.time()
try: try:
@@ -540,9 +541,9 @@ class BatchTableExtractorApp:
import traceback import traceback
trace_str = traceback.format_exc() trace_str = traceback.format_exc()
if self.debug_var.get(): if self.debug_var.get():
err_msg = f" ❌ 失败跳过 [{base_name}]: {e}\n{trace_str}" err_msg = f" ❌ 失败跳过 [{full_name}]: {e}\n{trace_str}"
else: else:
err_msg = f" ❌ 失败跳过 [{base_name}]: {e}" err_msg = f" ❌ 失败跳过 [{full_name}]: {e}"
self.root.after(0, lambda m=err_msg: self.log(m, tag="error")) self.root.after(0, lambda m=err_msg: self.log(m, tag="error"))
record_log(batch_id, "失败", base_name, "-", 0, duration, file_path, f"{e}\n{trace_str}") record_log(batch_id, "失败", base_name, "-", 0, duration, file_path, f"{e}\n{trace_str}")