ERPNext-OCR icon indicating copy to clipboard operation
ERPNext-OCR copied to clipboard

Public files not managed

Open madmath03 opened this issue 6 years ago • 0 comments

Steps:

  • Install ERPNext OCR
  • Go to Erpnext Ocr > OCR Read and save a new read
  • Select any image and save
  • Request to read the image
  • Error occurs with error FileNotFoundError: [Errno 2] No such file or directory: './mylocalsite/files/myrandom_image-500x204.png'

After looking at the folders, the file is actually located at ./mylocalsite/public/files/ and not just ./mylocalsite/files/.

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 56, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1032, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 84, in runserverobj
    frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/run_method.py", line 36, in runserverobj
    r = doc.run_method(method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 772, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1048, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1031, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 766, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext_ocr/erpnext_ocr/erpnext_ocr/doctype/ocr_read/ocr_read.py", line 46, in read_image
    im = Image.open(fullpath)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/PIL/Image.py", line 2652, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: './mylocalsite/files/myrandom_image-500x204.png'

Will try to provide a PR for that too.

madmath03 avatar Jun 26 '19 23:06 madmath03