ReceiptManager / receipt-parser-server

Receipt parser server written in python.
https://receipt-parser-server.readthedocs.io/en/master/
94 stars 20 forks source link

On image upload: FileNotFoundError: [Errno 2] No such file or directory #31

Closed JavaJeremy closed 3 years ago

JavaJeremy commented 3 years ago

First I installed it through Docker with that guide. Then I successfully input the IP (the one that launcher.sh outputs in the beginning Current IP is: ...) and Token-ID into the app. (HTTPS and Legacy Parser are enabled) My server and my phone are in completely different networks. Then I took a picture of a receipt, got an error in the app and saw this error on the server:

CAP8674934207412462448.jpg
Store file at: /app/data/img/CAP8674934207412462448.jpg
INFO:     <i.p.>:<port> - "POST /api/upload?access_token=<token>&legacy_parser=True&grayscale_image=True&gaussian_blur=True&rotate=False HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 398, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.6/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/dist-packages/fastapi/applications.py", line 201, in __call__
    await super().__call__(scope, receive, send)  # pragma: no cover
  File "/usr/local/lib/python3.6/dist-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.6/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.6/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.6/dist-packages/starlette/middleware/cors.py", line 78, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.6/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.6/dist-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.6/dist-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.6/dist-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.6/dist-packages/fastapi/routing.py", line 202, in app
    dependant=dependant, values=values, is_coroutine=is_coroutine
  File "/usr/local/lib/python3.6/dist-packages/fastapi/routing.py", line 148, in run_endpoint_function
    return await dependant.call(**values)
  File "/app/src/receipt_server.py", line 154, in get_open_api_endpoint
    with open(output, "wb") as buffer:
FileNotFoundError: [Errno 2] No such file or directory: '/app/data/img/CAP8674934207412462448.jpg'

Unfortunately I have no idea what I could try to fix this problem. Any guesses what could fix this error?

monolidth commented 3 years ago

Looks like an documentation error as well.

What happened is the following:

A solution could be, to create the data structure.

Sorry for the inconvenience.

Regards, William

JavaJeremy commented 3 years ago

Thanks, those 3 commands fixed that problem indeed!