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

chdir to workspace #19

Closed
bertsky opened this issue Oct 23, 2020 · 1 comment
Closed

chdir to workspace #19

bertsky opened this issue Oct 23, 2020 · 1 comment

Comments

@bertsky
Copy link
Contributor

bertsky commented Oct 23, 2020

Since merging editable, there's a new problem: If I pass a filesystem path for METS on the command line that does not resolve to the current working directory, or if I select a METS in the open dialog that is in another directory, then as soon as I try to open the PageView or TextView, it crashes with the following trace:

  File "ocrd_browser/view/base.py", line 66, in <lambda>
    configurator.connect('changed', lambda _source, *value: self.config_changed(name, value))
  File "ocrd_browser/view/text.py", line 45, in config_changed
    self.reload()
  File "ocrd_browser/view/base.py", line 86, in reload
    self.current = self.document.page_for_id(self.page_id, self.use_file_group)
  File "ocrd_browser/model/document.py", line 356, in page_for_id
    image, _, _ = self.workspace.image_from_page(pcgts.get_Page(), page_id)
  File "ocrd/workspace.py", line 419, in image_from_page
    page_image_info = self.resolve_image_exif(page.imageFilename)
  File "ocrd/workspace.py", line 271, in resolve_image_exif
    ocrd_exif = exif_from_filename(image_filename)
  File "ocrd_modelfactory/__init__.py", line 32, in exif_from_filename
    with Image.open(image_filename) as pil_img:
  File "PIL/Image.py", line 2878, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] Datei oder Verzeichnis nicht gefunden: 'OCR-D-IMG/OCR-D-IMG_0001.tif'

This looks like we should chdir to the workspace directory after opening it (as all processors do; most core classes were written for them).

@hnesk hnesk closed this as completed in 3f048a7 Oct 23, 2020
@bertsky
Copy link
Contributor Author

bertsky commented Oct 24, 2020

Thanks @hnesk!

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

1 participant