🐛 Fix loading ocrd-tool.json for Python 3.12

pull/113/head
Mike Gerber 4 months ago
parent bc5818da9f
commit 4047f8b6e5

@ -11,3 +11,4 @@ multimethod >= 1.3
tqdm
rapidfuzz >= 2.7.0
chardet
importlib_resources

@ -1,3 +1,4 @@
import importlib_resources
import json
import os
@ -5,11 +6,14 @@ import click
from ocrd import Processor
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor
from ocrd_utils import assert_file_grp_cardinality, getLogger, make_file_id
from pkg_resources import resource_string
from .cli import process as cli_process
OCRD_TOOL = json.loads(resource_string(__name__, "ocrd-tool.json").decode("utf8"))
OCRD_TOOL = json.loads(
importlib_resources.files(__name__)
.joinpath("ocrd-tool.json")
.read_text(encoding="utf-8", errors="strict")
)
@click.command()

Loading…
Cancel
Save