You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But that fails if the processor module itself is distributed via PEP-420 namespace packages (so the top level does not contain any resources).
For example, in case of ocrd-eynollah-segment, we have qurator.eynollah as the actual processor module, but qurator itself is empty:
File "/data/ocr-d/ocrd_all/venv/lib/python3.7/site-packages/qurator/eynollah/processor.py", line 47, in process
'dir_models': self.resolve_resource(self.parameter['models']),
File "/data/ocr-d/ocrd_all/venv/lib/python3.7/site-packages/ocrd/processor/base.py", line 219, in resolve_resource
cwd=cwd, moduled=self.moduledir)
File "/data/ocr-d/ocrd_all/venv/lib/python3.7/site-packages/ocrd/processor/base.py", line 257, in moduledir
return resource_filename(self.module, '')
File "/data/ocr-d/ocrd_all/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1154, in resource_filename
return get_provider(package_or_requirement).get_resource_filename(
File "/data/ocr-d/ocrd_all/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 361, in get_provider
return _find_adapter(_provider_factories, loader)(module)
File "/data/ocr-d/ocrd_all/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1403, in __init__
self.module_path = os.path.dirname(getattr(module, '__file__', ''))
File "/usr/lib/python3.7/posixpath.py", line 156, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
I don't know what's the correct way to deal with this, but it seems to suffice checking that a .__file__ exists at the module level – for namespaces this is None.
The text was updated successfully, but these errors were encountered:
I don't know what's the correct way to deal with this, but it seems to suffice checking that a .__file__ exists at the module level – for namespaces this is None.
Judging by the documentation of __file__ and __package__, I do think this is the test we have to make: traverse the module path from top to current and stop as soon as we find a package that has_location.
Since #904 we look up …
core/ocrd/ocrd/processor/base.py
Lines 246 to 250 in 71d295a
But that fails if the processor module itself is distributed via PEP-420 namespace packages (so the top level does not contain any resources).
For example, in case of ocrd-eynollah-segment, we have
qurator.eynollah
as the actual processor module, butqurator
itself is empty:I don't know what's the correct way to deal with this, but it seems to suffice checking that a
.__file__
exists at the module level – for namespaces this isNone
.The text was updated successfully, but these errors were encountered: