qurator-spk/eynollah

Please release a new version with fix for model download

Closed this issue · 2 comments

b049e47 fixed the model download, but is not in the release.

With 0.3.0 you can't download the model using ocrd resmgr download ocrd-eynollah-segment default:

15:44:30.208 INFO ocrd.resource_manager.download - Copying 'default' from archive to /home/mike/.local/share/ocrd-resources/ocrd-eynollah-segment/default

Traceback (most recent call last):
  File "/usr/local/share/pyenv/versions/3.7.17/bin/ocrd", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/ocrd/cli/resmgr.py", line 165, in download
    progress_cb=lambda delta: bar.update(delta)
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/site-packages/ocrd/resource_manager.py", line 346, in download
    copy(path_in_archive, str(fpath))
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/local/share/pyenv/versions/3.7.17/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'default'

I believe this warrants a hot-fix.

This took me a while to understand. @kba Is it possible to improve the error handling in the resource manager a bit, e.g. print out a clear error that path_in_archive from ocrd-tool,json (incl. mentioning field and JSON) does not exist in the archive? That would have helped and I believe this could be problem that will come again.

Workaround is to install the current main branch into a temporary venv and use that to get the model:

# (in a temp venv)
pip install git+https://github.com/qurator-spk/eynollah.git@main
ocrd resmgr download ocrd-eynollah-segment default