-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_tesseract.py
More file actions
41 lines (33 loc) · 1.39 KB
/
check_tesseract.py
File metadata and controls
41 lines (33 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import shutil
import os
import sys
def check_tesseract():
print("--- Tesseract Diagnostic ---")
# 1. Check PATH
path_tesseract = shutil.which("tesseract")
if path_tesseract:
print(f"✅ FOUND in PATH: {path_tesseract}")
return
else:
print("❌ NOT FOUND in PATH (This current terminal session cannot see it).")
# 2. Check Standard Locations
common_paths = [
r"C:\Program Files\Tesseract-OCR\tesseract.exe",
r"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe",
r"C:\Users\vansh\AppData\Local\Tesseract-OCR\tesseract.exe"
]
found_manual = False
for p in common_paths:
if os.path.exists(p):
print(f"✅ FOUND at specific location: {p}")
print(" (The application code is patched to use this automatically!)")
found_manual = True
break
if not path_tesseract and not found_manual:
print("⚠️ Tesseract executable not found in PATH or standard locations.")
print(" Please ensure you installed it to 'C:\\Program Files\\Tesseract-OCR'")
print(" OR restart VS Code if you just added it to PATH.")
elif not path_tesseract and found_manual:
print("\nSUMMARY: You are good to go! The app will find it manually.")
if __name__ == "__main__":
check_tesseract()