fix: module 'traceback' has no attribute 'logger'

This commit is contained in:
zstar 2025-06-11 10:22:30 +08:00
parent f1b097d9df
commit 622fc32619
3 changed files with 3 additions and 3 deletions

View File

@ -57,6 +57,7 @@ services:
volumes: volumes:
- ./ragflow-plus-logs:/app/logs - ./ragflow-plus-logs:/app/logs
- ./magic-pdf.json:/root/magic-pdf.json - ./magic-pdf.json:/root/magic-pdf.json
- ../management/server/services/knowledgebases/document_parser.py:/app/services/knowledgebases/document_parser.py
depends_on: depends_on:
mysql: mysql:
condition: service_healthy condition: service_healthy

View File

@ -54,7 +54,9 @@ services:
ports: ports:
- "5000:5000" - "5000:5000"
volumes: volumes:
- ./ragflow-plus-logs:/app/logs
- ./magic-pdf-gpu.json:/root/magic-pdf.json - ./magic-pdf-gpu.json:/root/magic-pdf.json
- ../management/server/services/knowledgebases/document_parser.py:/app/services/knowledgebases/document_parser.py
depends_on: depends_on:
mysql: mysql:
condition: service_healthy condition: service_healthy

View File

@ -5,7 +5,6 @@ import re
import shutil import shutil
import tempfile import tempfile
import time import time
import traceback
from datetime import datetime from datetime import datetime
from io import BytesIO from io import BytesIO
from urllib.parse import urlparse from urllib.parse import urlparse
@ -593,7 +592,6 @@ def perform_parse(doc_id, doc_info, file_info, embedding_config, kb_info):
except Exception as e: except Exception as e:
logger.error(f"[Parser-ERROR] 处理文本块 {chunk_idx} (page: {page_idx}, bbox: {bbox}) 失败: {e}") logger.error(f"[Parser-ERROR] 处理文本块 {chunk_idx} (page: {page_idx}, bbox: {bbox}) 失败: {e}")
traceback.logger.info_exc() # 打印更详细的错误
raise Exception(f"[Parser-ERROR] 处理文本块 {chunk_idx} (page: {page_idx}, bbox: {bbox}) 失败: {e}") raise Exception(f"[Parser-ERROR] 处理文本块 {chunk_idx} (page: {page_idx}, bbox: {bbox}) 失败: {e}")
elif chunk_data["type"] == "image": elif chunk_data["type"] == "image":
@ -699,7 +697,6 @@ def perform_parse(doc_id, doc_info, file_info, embedding_config, kb_info):
# error_message = f"解析失败: {str(e)}" # error_message = f"解析失败: {str(e)}"
logger.error(f"[Parser-ERROR] 文档 {doc_id} 解析失败: {e}") logger.error(f"[Parser-ERROR] 文档 {doc_id} 解析失败: {e}")
error_message = f"解析失败: {e}" error_message = f"解析失败: {e}"
traceback.logger.info_exc() # 打印详细错误堆栈
# 更新文档状态为失败 # 更新文档状态为失败
_update_document_progress(doc_id, status="1", run="0", message=error_message, process_duration=process_duration) # status=1表示完成run=0表示失败 _update_document_progress(doc_id, status="1", run="0", message=error_message, process_duration=process_duration) # status=1表示完成run=0表示失败
return {"success": False, "error": error_message} return {"success": False, "error": error_message}