I have a problem with tesseract (I'm working with Pycharm). When I run the script everything is ok. But when I define a method and run it in the terminal, it raises an error:
TesseractNotFoundError: C:\Users\nom_utilisateur\AppData\Local\Tesseract-OCR\tesseract is not installed or it's not in your path
The problem is, why did it show a path that I didn't define in the beginning of the script as tesseract's path? Here is my script's head:
from PIL import Image
import re
import argparse
import cv2
import pytesseract
import numpy as np
from pytesseract import Output
import sys
pytesseract.pytesseract.tesseract_cmd = r'C:/Program Files/Tesseract-OCR/tesseract.exe'
my method:
if __name__ == "__main__":
img_path = sys.argv[1]
corrections_file = sys.argv[2]
output_img_file = sys.argv[3]
output_text_file = sys.argv[4]
demo(img_path, corrections_file, output_img_file, output_text_file)