Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing resources.yml not handled properly #1171

Open
MehmedGIT opened this issue Jan 23, 2024 · 1 comment
Open

Missing resources.yml not handled properly #1171

MehmedGIT opened this issue Jan 23, 2024 · 1 comment

Comments

@MehmedGIT
Copy link
Contributor

In some cases, when the ~/.config/ocrd/resources.yml file is completely missing, the ocrd resmgr does not report that properly.

(venv38-core) mm@MM-Notebook:~/repos/core$ ocrd resmgr download ocrd-tesserocr-recognize '*'
/home/mm/venv38-core/lib/python3.8/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (None)/charset_normalizer (3.3.2) doesn't match a supported version!
  warnings.warn(
11:45:00.255 ERROR ocrd.cli.resmgr - Executable 'ocrd-tesserocr-recognize' is not installed. To download resources anyway, use the -a/--allow-uninstalled flag
(venv38-core) mm@MM-Notebook:~/repos/core$ ocrd resmgr download -a ocrd-tesserocr-recognize '*'
/home/mm/venv38-core/lib/python3.8/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (None)/charset_normalizer (3.3.2) doesn't match a supported version!
  warnings.warn(
11:45:05.814 INFO ocrd.cli.resmgr - Executable ocrd-tesserocr-recognize is not installed, but downloading resources anyway
11:45:05.814 INFO ocrd.cli.resmgr - No resources None found in registry for executable ocrd-tesserocr-recognize
@bertsky
Copy link
Collaborator

bertsky commented Mar 6, 2024

Even worse, in my case (ocrd==c8aef091e18ce4e79cb3a3b7399ac908c90a169d), the processor is already installed, but resmgr crashes:

ocrd resmgr download ocrd-tesserocr-recognize frak2021.traineddata
Traceback (most recent call last):
  File "/data/ocr-d/ocrd_all/venv38/bin/ocrd", line 8, in <module>
    sys.exit(cli())
  File "/data/ocr-d/ocrd_all/venv38/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/data/ocr-d/ocrd_all/venv38/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/data/ocr-d/ocrd_all/venv38/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/data/ocr-d/ocrd_all/venv38/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/data/ocr-d/ocrd_all/venv38/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/data/ocr-d/ocrd_all/venv38/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/data/ocr-d/ocrd_all/core/src/ocrd/cli/resmgr.py", line 92, in download
    resmgr = OcrdResourceManager()
  File "/data/ocr-d/ocrd_all/core/src/ocrd/resource_manager.py", line 46, in __init__
    self.save_user_list()
  File "/data/ocr-d/ocrd_all/core/src/ocrd/resource_manager.py", line 70, in save_user_list
    with open(self.user_list, 'w', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/bertsky/.config/ocrd/resources.yml'

(The resources.yml in question is a broken symlink. Still, resmgr should tolerate this, ignoring the user config.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants