BenoitAnastay / paperless-home-assistant-addon

Paperless Home Assistant Addon
MIT License
35 stars 7 forks source link

document_export with failure #182

Closed MatzeP closed 2 weeks ago

MatzeP commented 3 weeks ago

Hi, Sorry to open this issue again, but I do it like description from you in another post from April.

root@ca5234a0-paperless-ngx:/usr/src# PAPERLESS_DATA_DIR=/config/data root@ca5234a0-paperless-ngx:/usr/src# echo $PAPERLESS_DATA_DIR /config/data root@ca5234a0-paperless-ngx:/usr/src# PAPERLESS_MEDIA_ROOT=/share/paperless/media root@ca5234a0-paperless-ngx:/usr/src# echo $PAPERLESS_MEDIA_ROOT /share/paperless/media root@ca5234a0-paperless-ngx:/usr/src# document_exporter /share/paperless/export CommandError: That path doesn't exist root@ca5234a0-paperless-ngx:/usr/src# cd /share/paperless root@ca5234a0-paperless-ngx:/share/paperless# ls consume media root@ca5234a0-paperless-ngx:/share/paperless# document_exporter /share/paperless/media Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such table: documents_correspondent

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/paperless/src/manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, *cmd_options) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 458, in execute output = self.handle(args, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 215, in handle self.dump() File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 279, in dump serializers.serialize("json", manifest_key_to_object_query[key]), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/core/serializers/init.py", line 134, in serialize s.serialize(queryset, options) File "/usr/local/lib/python3.11/dist-packages/django/core/serializers/base.py", line 132, in serialize for count, obj in enumerate(queryset, start=1): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 398, in iter self._fetch_all() File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 1881, in _fetch_all self._result_cache = list(self._iterable_class(self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 91, in iter results = compiler.execute_sql( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.OperationalError: no such table: documents_correspondent root@ca5234a0-paperless-ngx:/share/paperless#

BenoitAnastay commented 3 weeks ago

You may need to create the folder prior export

mkdir /share/paperless/export
MatzeP commented 3 weeks ago

Hi,

thank you. Here my test.

root@ca5234a0-paperless-ngx:/share/paperless# PAPERLESS_DATA_DIR=/config/data root@ca5234a0-paperless-ngx:/share/paperless# echo $PAPERLESS_DATA_DIR /config/data root@ca5234a0-paperless-ngx:/share/paperless# PAPERLESS_MEDIA_ROOT=/share/paperless/media root@ca5234a0-paperless-ngx:/share/paperless# echo $PAPERLESS_MEDIA_ROOT /share/paperless/media root@ca5234a0-paperless-ngx:/share/paperless# mkdir /share/paperless/export root@ca5234a0-paperless-ngx:/share/paperless# ls -l total 12 drwxr-xr-x 2 paperless paperless 4096 Oct 29 20:20 consume drwxr-xr-x 2 root root 4096 Oct 30 22:56 export drwxr-xr-x 3 paperless paperless 4096 Oct 29 20:20 media root@ca5234a0-paperless-ngx:/share/paperless# document_exporter /share/paperless/export CommandError: That path doesn't appear to be writable root@ca5234a0-paperless-ngx:/share/paperless# chown paperless:paperless /share/paperless/export/ root@ca5234a0-paperless-ngx:/share/paperless# ls -l total 12 drwxr-xr-x 2 paperless paperless 4096 Oct 29 20:20 consume drwxr-xr-x 2 paperless paperless 4096 Oct 30 22:56 export drwxr-xr-x 3 paperless paperless 4096 Oct 29 20:20 media root@ca5234a0-paperless-ngx:/share/paperless# document_exporter /share/paperless/export Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such table: documents_correspondent

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/paperless/src/manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, *cmd_options) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 459, in execute output = self.handle(args, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 218, in handle self.dump() File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 286, in dump serializers.serialize("json", manifest_key_to_object_query[key]), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/core/serializers/init.py", line 134, in serialize s.serialize(queryset, options) File "/usr/local/lib/python3.11/dist-packages/django/core/serializers/base.py", line 109, in serialize for count, obj in enumerate(queryset, start=1): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 400, in iter self._fetch_all() File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 1928, in _fetch_all self._result_cache = list(self._iterable_class(self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 91, in iter results = compiler.execute_sql( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1574, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 79, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 100, in _execute with self.db.wrap_database_errors: File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.OperationalError: no such table: documents_correspondent

root@ca5234a0-paperless-ngx:/share/paperless# chmod 777 export/ root@ca5234a0-paperless-ngx:/share/paperless# ls -l total 12 drwxr-xr-x 2 paperless paperless 4096 Oct 29 20:20 consume drwxrwxrwx 2 paperless paperless 4096 Oct 30 22:56 export drwxr-xr-x 3 paperless paperless 4096 Oct 29 20:20 media root@ca5234a0-paperless-ngx:/share/paperless# document_exporter /share/paperless/export Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such table: documents_correspondent

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/paperless/src/manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.11/dist-packages/django/core/management/init.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, *cmd_options) File "/usr/local/lib/python3.11/dist-packages/django/core/management/base.py", line 459, in execute output = self.handle(args, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 218, in handle self.dump() File "/usr/src/paperless/src/documents/management/commands/document_exporter.py", line 286, in dump serializers.serialize("json", manifest_key_to_object_query[key]), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/core/serializers/init.py", line 134, in serialize s.serialize(queryset, options) File "/usr/local/lib/python3.11/dist-packages/django/core/serializers/base.py", line 109, in serialize for count, obj in enumerate(queryset, start=1): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 400, in iter self._fetch_all() File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 1928, in _fetch_all self._result_cache = list(self._iterable_class(self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/query.py", line 91, in iter results = compiler.execute_sql( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/models/sql/compiler.py", line 1574, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 79, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 100, in _execute with self.db.wrap_database_errors: File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.11/dist-packages/django/db/backends/utils.py", line 105, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/django/db/backends/sqlite3/base.py", line 354, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.OperationalError: no such table: documents_correspondent root@ca5234a0-paperless-ngx:/share/paperless#

Can it be possible that the reason is the database? I change it from homeassistant standard to mariadb.

BenoitAnastay commented 3 weeks ago

Have you tried with inline environments variables?

PAPERLESS_DATA_DIR=/config/data PAPERLESS_MEDIA_ROOT=/share/paperless/media document_exporter /share/paperless/export
MatzeP commented 2 weeks ago

Hi,

It works!!

BenoitAnastay commented 2 weeks ago

Duplicate of #130