icbestCA / giftmanager

Gift ideas manager for families. See the demo here: https://giftmanagerdemo.pages.dev/
MIT License
74 stars 4 forks source link

[Bug] FileNotFound [Errno 2] For ideas.json #20

Closed royaltongue closed 1 month ago

royaltongue commented 1 month ago

After updating to the image you published yesterday, I wasn't able to view my own ideas. I erased all of my config information and went back in with the default demo:password user, but see the same error when trying to look at /my_ideas or /user_gift_ideas/user2

The full error is below:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1498, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1476, in wsgi_app
    response = self.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app.py", line 99, in decorated_function
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/app/app.py", line 608, in user_gift_ideas
    gift_ideas_data = read_gift_ideas()
                      ^^^^^^^^^^^^^^^^^
  File "/app/app.py", line 624, in read_gift_ideas
    with open('ideas.json', 'r') as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'ideas.json'

I checked and the container did create both users.json and ideas.json in /app/data

icbestCA commented 1 month ago

Thanks, I forgot to change the reading function for docker. Will be fixed in 2 hours.

icbestCA commented 1 month ago

Now fixed, the image is built and pushed. Was simply on line 624 i added a reading function last time and forgot to edit the docker version since it uses volumes. Thanks