paperwork-shell crashes for multiple commands
Preface
New user of openpaperwork, I love it so far!
I am using it on Arch Linux, which does not bundle paperwork-shell by default (See file list on https://archlinux.org/packages/community/any/paperwork/). So I modified my installation and now some commands of paperwork-json
and paperwork-cli
work, while others give me errors that I do not understand.
A warning right from the start: Since I installed openpaperwork manually I am not sure if I have all dependencies installed or if there was another "packaging" related error that I ran into, so if a better place to discuss this would be the forum, please let me know and I will move this over there.
I am using the latest version from Git (Tag 507b53f2), the issues also happened with version 2.0.2, if I remember correctly.
Some information about my installation
Some Python library versions:
Python 3.9.2 (default, Feb 20 2021, 18:40:11)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyocr, pillowfight
>>> import fabulous, getkey, pillowfight, pyocr
>>> fabulous.__version__
'0.3.0'
>>> getkey.__version__
'0.6.5'
>>> pillowfight.__version__
'0.3.0'
>>> pyocr.VERSION
('0', '9', 'dev0+gf9f93bb', 'd20210129')
>>>
libinsane-Version:
$ pacman -Qi libinsane
Name : libinsane
Version : 1.0.9-1
[...]
Paperwork's chkdeps
:
$ paperwork-cli chkdeps
Detected system: arch rolling n/a
[WARNING] [openpaperwork_core.cmd.chkdeps] WARNING: Unknown distribution. Can't suggest packages to install
Nothing to do.
$ paperwork-json chkdeps
[WARNING] [openpaperwork_core.cmd.chkdeps] WARNING: Unknown distribution. Can't suggest packages to install
{
"command": null,
"missing": {}
}
$ paperwork-gtk chkdeps
Detected system: arch rolling n/a
[WARNING] [openpaperwork_core.cmd.chkdeps] WARNING: Unknown distribution. Can't suggest packages to install
Nothing to do.
This is the PKGBUILD
-file that I used to install paperwork. If you are unfamiliar with the packaging system of Arch Linux, then to summarize it, the functions build
and package
are executed and afterwards everything that is contained in the directory $pkgdir
is packaged and installed in the system:
pkgname=paperwork-incl
pkgver=2.0.2+49+g507b53f2
pkgrel=1
pkgdesc="Shell of the personal document manager for GNOME to manage scanned documents and PDFs"
arch=(any)
url="https://openpaper.work/"
license=(GPL3)
depends=(gtk3 libinsane libnotify poppler-glib python-cairo python-dateutil python-distro
python-gobject python-levenshtein python-pillowfight python-pycountry python-pydbus
python-pyocr python-setuptools python-simplebayes python-whoosh python-pyxdg python-psutil)
makedepends=(git)
provides=(paperwork paperwork-shell)
conflicts=(paperwork paperwork-shell)
_commit=507b53f2eb6a11301a96c75f05aa98c73e524da4
source=("git+https://gitlab.gnome.org/World/OpenPaperwork/paperwork.git#commit=$_commit"
"$pkgname-$pkgver-data.tar.gz::https://download.openpaper.work/data/paperwork/master_${_commit:0:8}/data.tar.gz")
sha256sums=('SKIP' 'SKIP')
pkgver() {
cd paperwork
git describe --tags | sed 's/-/+/g'
}
build() {
cd paperwork
tar -xvzf ../$pkgname-$pkgver-data.tar.gz
make version version=$pkgver
make l10n_compile
}
package() {
cd paperwork
for dir in openpaperwork-{core,gtk} paperwork-{backend,gtk,shell}; do
pushd $dir
python3 setup.py install --root="$pkgdir" --optimize=1
popd
done
PYTHONPATH=`echo "$pkgdir"/usr/lib/python*/site-packages/` \
"$pkgdir"/usr/bin/paperwork-gtk install \
--icon_base_dir="$pkgdir/usr/share/icons" \
--data_base_dir="$pkgdir/usr/share"
}
Error Descriptions
Searching with paperwork-cli
fails, whereas it works with paperwork-json
, see the following outputs:
$ paperwork-cli search
[ERROR ] [openpaperwork_core ] Callback '<bound method Plugin.page_get_boxes_by_url of <paperwork_backend.model.pdf.Plugin object at 0x7fb7f4763c10>>' failed
[ERROR ] [openpaperwork_core.logs.print ] === UNCAUGHT EXCEPTION ===
Traceback (most recent call last):
File "/usr/bin/paperwork-cli", line 33, in <module>
sys.exit(load_entry_point('paperwork-shell==2.0.2', 'console_scripts', 'paperwork-cli')())
File "/usr/lib/python3.9/site-packages/paperwork_shell/main.py", line 115, in cli_main
main_main(
File "/usr/lib/python3.9/site-packages/paperwork_shell/main.py", line 77, in main_main
r = core.call_all("cmd_run", args)
File "/usr/lib/python3.9/site-packages/openpaperwork_core/__init__.py", line 411, in call_all
callback(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/paperwork_shell/cmd/search.py", line 106, in cmd_run
lines = renderer.get_preview_output(
File "/usr/lib/python3.9/site-packages/paperwork_shell/display/docrendering/img.py", line 27, in get_preview_output
parent = self.parent.get_preview_output(
File "/usr/lib/python3.9/site-packages/paperwork_shell/display/docrendering/labels.py", line 64, in get_preview_output
out = self.parent.get_preview_output(
File "/usr/lib/python3.9/site-packages/paperwork_shell/display/docrendering/text.py", line 54, in get_preview_output
text = self._get_page_text(doc_url, page_idx)
File "/usr/lib/python3.9/site-packages/paperwork_shell/display/docrendering/text.py", line 14, in _get_page_text
line_boxes = self.core.call_success(
File "/usr/lib/python3.9/site-packages/openpaperwork_core/__init__.py", line 510, in call_success
r = callback(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/paperwork_backend/model/pdf.py", line 682, in page_get_boxes_by_url
return self.core.call_one(
File "/usr/lib/python3.9/site-packages/openpaperwork_core/__init__.py", line 459, in call_one
return callbacks[0][2](*args, **kwargs)
File "/usr/lib/python3.9/site-packages/openpaperwork_gtk/mainloop/glib.py", line 199, in mainloop_execute
return func(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/paperwork_backend/model/pdf.py", line 661, in _page_get_boxes_by_url
for (line, line_rects) in self._custom_split(
File "/usr/lib/python3.9/site-packages/paperwork_backend/model/pdf.py", line 536, in _custom_split
assert(len(input_str) == len(input_rects))
AssertionError
[ERROR ] [openpaperwork_core.logs.print ] ==========================
$ paperwork-json search | head -n 2
[
"20210328_1634_21_1",
On the other hand paperwork-cli
works for the show
command. It displays the image and the text of the document on the terminal and prints some information to stderr
:
$ paperwork-cli show 20210328_1634_21_1
[WARNING] [openpaperwork_core.perfcheck.log] Task 'surface2image' took 604ms (> 200ms) ! ({'size': (1508, 2284)})
[WARNING] [openpaperwork_core.perfcheck.log] Task 'surface2image' took 602ms (> 200ms) ! ({'size': (1508, 2284)})
Whereas paperwork-json
does exits with errorcode 2 for the same command:
$ paperwork-json show 20210328_1634_21_1
[WARNING] [openpaperwork_core ] No method 'doc_renderer_get' found
[ERROR ] [openpaperwork_core ] Callback '<bound method Plugin.cmd_run of <paperwork_shell.cmd.show.Plugin object at 0x7fca64d366a0>>' failed
{
"args": "()",
"exception": "<class 'AssertionError'>",
"reason": "",
"stack": [
"Traceback (most recent call last):",
" File \"/usr/lib/python3.9/site-packages/paperwork_shell/main.py\", line 87, in json_main",
" r = main_main(",
" File \"/usr/lib/python3.9/site-packages/paperwork_shell/main.py\", line 79, in main_main",
" r = core.call_success(\"cmd_run\", args)",
" File \"/usr/lib/python3.9/site-packages/openpaperwork_core/__init__.py\", line 510, in call_success",
" r = callback(*args, **kwargs)",
" File \"/usr/lib/python3.9/site-packages/paperwork_shell/cmd/show.py\", line 77, in cmd_run",
" assert(len(renderers) > 0)",
"AssertionError"
],
"status": "error"
}
Other commands such as label list
work for both paperwork-cli
and paperwork-json
.
As I said, I am not sure, if this is a bug in openpaperwork or if my installation is broken. I would be happy in providing more details if those are necessary for you to pinpoint the root cause.