… there's a module-level instantiation of OcrdResourceManager, whose constructor does a getLogger, which in turns calls initLogging.
Thus,
CRITICAL root - getLogger was called before initLogging. Source of the call:
CRITICAL root - File "venv/lib/python3.6/site-packages/ocrd/resource_manager.py", line 26, in __init__
CRITICAL root - self.log = getLogger('ocrd.resource_manager')
CRITICAL root - initLogging was called multiple times. Source of latest call:
CRITICAL root - File "venv/lib/python3.6/site-packages/ocrd/decorators/__init__.py", line 49, in ocrd_cli_wrap_processor
CRITICAL root - initLogging()
Given that we need that directory in all processors, but only to setup processing (i.e. after init / before process), how about merely exporting this as a function in config.py …
def get_path():
if 'TESSDATA_PREFIX' in os.environ:
return os.environ['TESSDATA_PREFIX']
else:
location = OcrdResourceManager().default_resource_dir
return join(location, 'ocrd-tesserocr-recognize')
In the current implementation of the resmgr based resolution of the
TESSDATA_PREFIX
…https://github.com/OCR-D/ocrd_tesserocr/blob/fd173868d20154068d9e659c57a09c2b55a4a9bc/ocrd_tesserocr/config.py#L10-L14
… there's a module-level instantiation of
OcrdResourceManager
, whose constructor does agetLogger
, which in turns callsinitLogging
.Thus,
Given that we need that directory in all processors, but only to setup processing (i.e. after init / before
process
), how about merely exporting this as a function inconfig.py
……and then in each processor, do …