Skip to content

Commit

Permalink
🐛 Fix loading ocrd-tool.json for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mikegerber committed Jul 9, 2024
1 parent bc5818d commit 4047f8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ multimethod >= 1.3
tqdm
rapidfuzz >= 2.7.0
chardet
importlib_resources
8 changes: 6 additions & 2 deletions src/dinglehopper/ocrd_cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import importlib_resources
import json
import os

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()
Expand Down

0 comments on commit 4047f8b

Please sign in to comment.