Skip to content

Commit ec94b75

Browse files
src/table.py: be stricter with USE_TGIF.
We now raise if USE_TGIF has an unexpected value.
1 parent cf7084f commit ec94b75

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/table.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@
9696
# This replace fz_find_table_within_bounds.
9797
USE_TGIF = os.getenv("USE_TGIF", "0")
9898
EXTRACTOR_V4 = None # Keep pylint happy.
99-
if USE_TGIF == "1":
99+
if USE_TGIF == "0":
100+
if os.environ.get('PYMUPDF_LEGACY_TABLE_DIAGNOSTIC') != '0':
101+
print("Using legacy table grid extraction.")
102+
elif USE_TGIF == "1":
100103
print("Using TGIFVx for table grid extraction.")
101104
import pymupdf.tgif # pylint: disable=import-error
102105
elif USE_TGIF == "4":
@@ -113,8 +116,7 @@
113116
# filter_empty_lines=not args.no_filter_empty,
114117
)
115118
else:
116-
if os.environ.get('PYMUPDF_LEGACY_TABLE_DIAGNOSTIC') != '0':
117-
print("Using legacy table grid extraction.")
119+
raise Exception(f"Unrecognised {USE_TGIF=}, should be unset, '0', '1' or '4'.")
118120

119121
EDGES = [] # vector graphics from PyMuPDF
120122
CHARS = [] # text characters from PyMuPDF

0 commit comments

Comments
 (0)