Skip to content

Commit 28d777a

Browse files
committed
修正报错消息
1 parent c45fa88 commit 28d777a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

crazy_functions/crazy_utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,16 @@ def ffsize_same(a,b):
469469
'- ', '') for t in text_areas['blocks'] if 'lines' in t]
470470

471471
############################## <第 2 步,获取正文主字体> ##################################
472-
fsize_statiscs = {}
473-
for span in meta_span:
474-
if span[1] not in fsize_statiscs: fsize_statiscs[span[1]] = 0
475-
fsize_statiscs[span[1]] += span[2]
476-
main_fsize = max(fsize_statiscs, key=fsize_statiscs.get)
477-
if REMOVE_FOOT_NOTE:
478-
give_up_fize_threshold = main_fsize * REMOVE_FOOT_FFSIZE_PERCENT
479-
472+
try:
473+
fsize_statiscs = {}
474+
for span in meta_span:
475+
if span[1] not in fsize_statiscs: fsize_statiscs[span[1]] = 0
476+
fsize_statiscs[span[1]] += span[2]
477+
main_fsize = max(fsize_statiscs, key=fsize_statiscs.get)
478+
if REMOVE_FOOT_NOTE:
479+
give_up_fize_threshold = main_fsize * REMOVE_FOOT_FFSIZE_PERCENT
480+
except:
481+
raise RuntimeError(f'抱歉, 我们暂时无法解析此PDF文档: {fp}。')
480482
############################## <第 3 步,切分和重新整合> ##################################
481483
mega_sec = []
482484
sec = []

0 commit comments

Comments
 (0)