Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocrd/ocrd/lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ocrd__parse_argv () {
-I|--input-file-grp) ocrd__argv[input_file_grp]=$2 ; shift ;;
-w|--working-dir) ocrd__argv[working_dir]=$(realpath "$2") ; shift ;;
-m|--mets) ocrd__argv[mets_file]=$(realpath "$2") ; shift ;;
--mets-server-url) ocrd_argv[mets_server_url]="$2" ; shift ;;
--mets-server-url) ocrd__argv[mets_server_url]="$2" ; shift ;;
--overwrite) ocrd__argv[overwrite]=true ;;
--profile) ocrd__argv[profile]=true ;;
--profile-file) ocrd__argv[profile_file]=$(realpath "$2") ; shift ;;
Expand Down
1 change: 1 addition & 0 deletions ocrd/ocrd/processor/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def run_cli(
result = run(args, check=False)
return result.returncode


def generate_processor_help(ocrd_tool, processor_instance=None, subcommand=None):
"""Generate a string describing the full CLI of this processor including params.

Expand Down
8 changes: 3 additions & 5 deletions ocrd_network/ocrd_network/process_helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
from typing import List, Optional
import logging
from contextlib import nullcontext

from ocrd.processor.helpers import run_cli, run_processor
Expand All @@ -27,13 +26,12 @@ def invoke_processor(

ctx_mgr = redirect_stderr_and_stdout_to_file(log_filename) if log_filename else nullcontext()
with ctx_mgr:
initLogging(force_reinit=True)
workspace = get_ocrd_workspace_instance(
mets_path=abs_path_to_mets,
mets_server_url=mets_server_url
)

if processor_class:
initLogging(force_reinit=True)
try:
run_processor(
processorClass=processor_class,
Expand All @@ -44,7 +42,7 @@ def invoke_processor(
parameter=parameters,
instance_caching=True,
mets_server_url=mets_server_url,
log_level=logging.DEBUG
log_level='DEBUG'
)
except Exception as e:
raise RuntimeError(f"Python executable '{processor_class.__dict__}' exited with: {e}")
Expand All @@ -58,7 +56,7 @@ def invoke_processor(
page_id=page_id,
parameter=json.dumps(parameters),
mets_server_url=mets_server_url,
log_level=logging.DEBUG
log_level='DEBUG'
)
if return_code != 0:
raise RuntimeError(f"CLI executable '{executable}' exited with: {return_code}")