File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments