Skip to content

Commit

Permalink
🐛 dinglehopper: Call initLogging before logging
Browse files Browse the repository at this point in the history
When using ocrd_utils' getLogger(), we need to call initLogging() before doing any
logging.

Fixes #55.
  • Loading branch information
mikegerber committed May 20, 2021
1 parent 1778b36 commit 2a6cc58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qurator/dinglehopper/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from jinja2 import Environment, FileSystemLoader
from markupsafe import escape
from uniseg.graphemecluster import grapheme_clusters
from ocrd_utils import initLogging

from .character_error_rate import character_error_rate_n
from .word_error_rate import word_error_rate_n, words_normalized
Expand Down Expand Up @@ -176,6 +177,7 @@ def main(gt, ocr, report_prefix, metrics, textequiv_level, progress):
By default, the text of PAGE files is extracted on 'region' level. You may
use "--textequiv-level line" to extract from the level of TextLine tags.
"""
initLogging()
Config.progress = progress
process(gt, ocr, report_prefix, metrics=metrics, textequiv_level=textequiv_level)

Expand Down
2 changes: 2 additions & 0 deletions qurator/dinglehopper/cli_extract.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import click
from ocrd_utils import initLogging

from .extracted_text import ExtractedText
from .ocr_files import extract
Expand All @@ -24,6 +25,7 @@ def main(input_file, textequiv_level):
By default, the text of PAGE files is extracted on 'region' level. You may
use "--textequiv-level line" to extract from the level of TextLine tags.
"""
initLogging()
input_text = extract(input_file, textequiv_level=textequiv_level).text
print(input_text)

Expand Down

0 comments on commit 2a6cc58

Please sign in to comment.