ok, habe jetzt das Problem bei pytesser gefunden, habe es einfach in meine Lib ordner gepackt und ne __init__.py dazugehauen mit dem import von pytesser. Doch leider ist die Lib schlecht geschrieben und funktioniert nicht als import. Habe gerade etwas rumprobiert, es jedoch nicht gnaz hinbekommen. Kann mir einen helfen, dass Teil importfähig zu machen?
Code: Alles auswählen
tesseract_exe_name ='tesseract' # Name of executable to be called at command line
scratch_image_name = "temp.bmp" # This file must be .bmp or other Tesseract-compatible format
scratch_text_name_root = "temp" # Leave out the .txt extension
cleanup_scratch_flag = True # Temporary files cleaned up after OCR operation
#########################################
def call_tesseract(input_filename, output_filename):
"""Calls external tesseract.exe on input file (restrictions on types),
outputting output_filename+'txt'"""
args = [tesseract_exe_name, input_filename, output_filename]
proc = subprocess.Popen(args)
retcode = proc.wait()
if retcode!=0:
errors.check_for_errors()
#################################
def image_to_scratch(im, scratch_image_name):
"""Saves image in memory to scratch file. .bmp format will be read correctly by Tesseract"""
im.save(scratch_image_name, dpi=(200,200))
Das sind ei Funktionien die man anpassen müsste. Ich habe es schon versucht, einfach den obrigen Variabeln den global PFad anzugeben, aber wollte auch nicht funktionieren. Hier Mal die Fehlermeldung:
Code: Alles auswählen
Traceback (most recent call last):
File "C:\Users\xxxxxxxxxx\python\xxxxxxxxxxxxxxx\pytest.py", line 8, in <module>
print pytesser.image_to_string(im)
File "C:\Program Files (x86)\Python\lib\pytesser\pytesser.py", line 31, in image_to_string
call_tesseract(scratch_image_name, scratch_text_name_root)
File "C:\Program Files (x86)\Python\lib\pytesser\pytesser.py", line 21, in call_tesseract
proc = subprocess.Popen(args)
File "C:\Program Files (x86)\Python\lib\subprocess.py", line 623, in __init__
errread, errwrite)
File "C:\Program Files (x86)\Python\lib\subprocess.py", line 833, in _execute_child
startupinfo)
WindowsError: [Error 2] Das System kann die angegebene Datei nicht finden