🐛 dinglehopper: Call initLogging before logging

When using ocrd_utils' getLogger(), we need to call initLogging() before doing any
logging.

Fixes #55.
pull/66/head
Gerber, Mike 4 years ago
parent 1778b36a9a
commit 2a6cc5823e

@ -4,6 +4,7 @@ import click
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
@ -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)

@ -1,6 +1,7 @@
import os
import click
from ocrd_utils import initLogging
from .extracted_text import ExtractedText
from .ocr_files import extract
@ -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)

Loading…
Cancel
Save