DavidMStraub / netviel

Web interface for the notmuch e-mail system
MIT License
54 stars 12 forks source link

FileNotFoundError with separate notmuch mail_root and database path #23

Open baba2k opened 1 year ago

baba2k commented 1 year ago

Hi,

the following database .notmuch-config

[database]
mail_root=/var/mail
path=/opt/notmuch

will produce a FileNotFoundError when selecting an email in netviel because the path is not correct. Mails are stored in /var/mail and not /opt/notmuch (only database).

Complete error log:

netviel    | [2023-04-09 21:10:49 +0000] [10] [ERROR] Socket error processing request.
netviel    | Traceback (most recent call last):
netviel    |   File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
netviel    |     self.handle_request(listener, req, client, addr)
netviel    |   File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 194, in handle_request
netviel    |     util.reraise(*sys.exc_info())
netviel    |   File "/usr/local/lib/python3.11/site-packages/gunicorn/util.py", line 626, in reraise
netviel    |     raise value
netviel    |   File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
netviel    |     respiter = self.wsgi(environ, resp.start_response)
netviel    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2551, in __call__
netviel    |     return self.wsgi_app(environ, start_response)
netviel    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2531, in wsgi_app
netviel    |     response = self.handle_exception(e)
netviel    |                ^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask_restful/__init__.py", line 271, in error_router
netviel    |     return original_handler(e)
netviel    |            ^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask_restful/__init__.py", line 268, in error_router
netviel    |     return self.handle_error(e)
netviel    |            ^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
netviel    |     response = self.full_dispatch_request()
netviel    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
netviel    |     rv = self.handle_user_exception(e)
netviel    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask_restful/__init__.py", line 271, in error_router
netviel    |     return original_handler(e)
netviel    |            ^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask_restful/__init__.py", line 268, in error_router
netviel    |     return self.handle_error(e)
netviel    |            ^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
netviel    |     rv = self.dispatch_request()
netviel    |          ^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
netviel    |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
netviel    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask_restful/__init__.py", line 467, in wrapper
netviel    |     resp = resource(*args, **kwargs)
netviel    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask/views.py", line 107, in view
netviel    |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)
netviel    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
netviel    |     resp = meth(*args, **kwargs)
netviel    |            ^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/netviel/api.py", line 107, in get
netviel    |     return messages_to_json(messages)
netviel    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/netviel/api.py", line 162, in messages_to_json
netviel    |     return [message_to_json(m) for m in messages]
netviel    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/netviel/api.py", line 162, in <listcomp>
netviel    |     return [message_to_json(m) for m in messages]
netviel    |             ^^^^^^^^^^^^^^^^^^
netviel    |   File "/usr/local/lib/python3.11/site-packages/netviel/api.py", line 167, in message_to_json
netviel    |     with open(message.get_filename(), "rb") as f:
netviel    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netviel    | FileNotFoundError: [Errno 2] No such file or directory: '/opt/notmuch/gmail-test/new/262898533.M6335P2662557Q0.ef6b6ef76076'

The correct path ist /var/mail/gmail-test/new/262898533.M6335P2662557Q0.ef6b6ef76076.

Thank you!