Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Failed to init API, possibly an invalid tessdata path: ./ #65

Open
safvanhuzain opened this issue Aug 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@safvanhuzain
Copy link

When i click the Read File button im getting this type of error from ocr_read.py. Please find the attached images

image

App Versions

{
	"erpnext": "14.2.1",
	"erpnext_ocr": "1.0.1",
	"frappe": "14.9.0",
	"frappe_whatsapp": "0.0.2",
	"helpdesk": "0.10.0",
	"hrms": "15.0.0-dev",
	"insights": "0.3.0",
	"ls_operations": "0.0.1",
	"payments": "0.0.1"
}

Route

Form/OCR Read/3d848e5a86

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1585, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/handler.py", line 304, in run_doc_method
    response = doc.run_method(method)
  File "apps/frappe/frappe/model/document.py", line 928, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1268, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1250, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 925, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext_ocr/erpnext_ocr/erpnext_ocr/doctype/ocr_read/ocr_read.py", line 55, in read_image
    return read_ocr(self)
  File "apps/erpnext_ocr/erpnext_ocr/erpnext_ocr/doctype/ocr_read/ocr_read.py", line 73, in read_ocr
    text = read_document(
  File "apps/erpnext_ocr/erpnext_ocr/erpnext_ocr/doctype/ocr_read/ocr_read.py", line 121, in read_document
    with PyTessBaseAPI(path='./',lang='tur') as api:
  File "tesserocr.pyx", line 1219, in tesserocr.PyTessBaseAPI.__cinit__
  File "tesserocr.pyx", line 1233, in tesserocr.PyTessBaseAPI._init_api
RuntimeError: Failed to init API, possibly an invalid tessdata path: ./

Request Data

{
	"type": "POST",
	"args": {
		"spell_checker": 1,
		"docs": "{\"name\":\"3d848e5a86\",\"owner\":\"[email protected]\",\"creation\":\"2023-08-23 14:28:44.232433\",\"modified\":\"2023-08-24 09:10:54.499563\",\"modified_by\":\"[email protected]\",\"docstatus\":0,\"idx\":0,\"language\":\"eng\",\"file_to_read\":\"/private/files/KSA-INV-206015.pdf\",\"spell_checker\":1,\"read_time\":\"0.0076868534088134766\",\"doctype\":\"OCR Read\",\"__last_sync_on\":\"2023-08-24T06:14:59.295Z\"}",
		"method": "read_image",
		"args": "{\"spell_checker\":1}"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/run_doc_method"
}

Response Data

{
	"exception": "RuntimeError: Failed to init API, possibly an invalid tessdata path: ./",
	"_server_messages": "[\"{\\\"message\\\": \\\"['eng']\\\", \\\"title\\\": \\\"Message\\\"}\"]"
}
@safvanhuzain safvanhuzain added the bug Something isn't working label Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant