Skip to content

Commit 1e26472

Browse files
author
prima
committed
fix: More error handling for pyinstaller
1 parent 60fb5f5 commit 1e26472

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

koboldcpp.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,12 +1905,11 @@ def sanitize_spans(line):
19051905
s0 = line[i - 1]
19061906
s1 = line[i]
19071907
delta = s1["size"] * 0.1
1908-
if s0["bbox"].x1 + delta < s1["bbox"].x0 or (
1909-
s0["flags"],
1910-
s0["char_flags"],
1911-
s0["size"],
1912-
) != (s1["flags"], s1["char_flags"], s1["size"]):
1913-
continue
1908+
try:
1909+
if s0["bbox"].x1 + delta < s1["bbox"].x0 or (s0["flags"], s0["char_flags"], s0["size"],) != (s1["flags"], s1["char_flags"], s1["size"]):
1910+
continue
1911+
except Exception:
1912+
print("Could not check char flags in bbox for similarity")
19141913

19151914
dashHandler = False
19161915
try:
@@ -2013,7 +2012,11 @@ def column_boxes(page, footer_margin=50, header_margin=50):
20132012

20142013
def format_span(s):
20152014
txt = s["text"]
2016-
bold = (s["flags"] & 16) or (s["char_flags"] & 8)
2015+
bold = False
2016+
try:
2017+
bold = (s["flags"] & 16) or (s["char_flags"] & 8)
2018+
except Exception:
2019+
print("Could not check for bold state on page")
20172020
italic = s["flags"] & 2
20182021
if bold and italic:
20192022
txt = f"***{txt}***"

0 commit comments

Comments
 (0)