🐛 Fix loading ocrd-tool.json for Python 3.12

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

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

@ -1,3 +1,4 @@
import importlib_resources
import json import json
import os import os
@ -5,11 +6,14 @@ import click
from ocrd import Processor from ocrd import Processor
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_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 ocrd_utils import assert_file_grp_cardinality, getLogger, make_file_id
from pkg_resources import resource_string
from .cli import process as cli_process 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() @click.command()

Loading…
Cancel
Save