Skip to content

Commit 6a5887a

Browse files
Update fastflix/models/config.py
Co-authored-by: Chris Griffith <chris@cdgriffith.com>
1 parent 5108f53 commit 6a5887a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

fastflix/models/config.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,13 @@ def find_ocr_tool(name):
111111

112112
# Special handling for tesseract on Windows (not in PATH by default)
113113
if name == "tesseract" and win_based:
114-
# Check common install locations on all drives
115-
import string
116-
drives = [f"{d}:" for d in string.ascii_uppercase if Path(f"{d}:/").exists()]
117-
118-
for drive in drives:
119-
common_paths = [
120-
Path(f"{drive}/Program Files/Tesseract-OCR/tesseract.exe"),
121-
Path(f"{drive}/Program Files (x86)/Tesseract-OCR/tesseract.exe"),
122-
]
123-
for path in common_paths:
124-
if path.exists():
125-
return path
114+
# Check common install locations
115+
for path in (
116+
Path(os.getenv("LOCALAPPDATA")) / "Programs/Tesseract-OCR",
117+
Path(os.getenv("PROGRAMFILES")) / "Tesseract-OCR",
118+
Path(os.getenv("PROGRAMFILES(x86)")) / "Tesseract-OCR"):
119+
if path.exists():
120+
return path
126121

127122
# Check Windows registry for Tesseract install location
128123
try:

0 commit comments

Comments
 (0)