Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid parameter - not of type boolean #194

Closed
MehmedGIT opened this issue Jun 19, 2023 · 2 comments
Closed

Invalid parameter - not of type boolean #194

MehmedGIT opened this issue Jun 19, 2023 · 2 comments

Comments

@MehmedGIT
Copy link

MehmedGIT commented Jun 19, 2023

Although I see the reason behind this error, I wonder if it is just not better to try parsing string parameters to a boolean where a boolean is expected.

Caused by:
  Process `ocrd_tesserocr_segment` terminated with an error exit status (1)

Command executed:

  singularity exec --bind /scratch1/users/mmustaf/operandi/slurm_workspaces/94200a5d-f332-4391-8699-92fbf81b4e7e --bind /scratch1/users/mmustaf/ocrd_models:/usr/local/share --env OCRD_METS_CACHING=true /scratch1/users/mmustaf/ocrd_all_maximum_image.sif ocrd-tesserocr-segment -m mets.xml -I OCR-D-BIN-DENOISE-DESKEW -O OCR-D-SEG -p '{"shrink_polygons": "true"}'

Command exit status:
  1

Command output:
  (empty)

Command error:
  Traceback (most recent call last):
    File "/usr/local/bin/ocrd-tesserocr-segment", line 33, in <module>
      sys.exit(load_entry_point('ocrd-tesserocr', 'console_scripts', 'ocrd-tesserocr-segment')())
    File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
      return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
      rv = self.invoke(ctx)
    File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
      return __callback(*args, **kwargs)
    File "/build/ocrd_tesserocr/ocrd_tesserocr/cli.py", line 18, in ocrd_tesserocr_segment
      return ocrd_cli_wrap_processor(TesserocrSegment, *args, **kwargs)
    File "/build/core/ocrd/ocrd/decorators/__init__.py", line 151, in ocrd_cli_wrap_processor
      run_processor(processorClass, mets_url=mets, workspace=workspace, **kwargs)
    File "/build/core/ocrd/ocrd/processor/helpers.py", line 86, in run_processor
      processor = get_processor(
    File "/build/core/ocrd/ocrd/processor/helpers.py", line 342, in get_processor
      return processor_class(
    File "/build/ocrd_tesserocr/ocrd_tesserocr/segment.py", line 15, in __init__
      super().__init__(*args, **kwargs)
    File "/build/ocrd_tesserocr/ocrd_tesserocr/recognize.py", line 130, in __init__
      super().__init__(*args, **kwargs)
    File "/build/core/ocrd/ocrd/processor/base.py", line 149, in __init__
      raise Exception("Invalid parameters %s" % report.errors)
  Exception: Invalid parameters ["[shrink_polygons] 'true' is not of type 'boolean'"]
@bertsky
Copy link
Collaborator

bertsky commented Jun 19, 2023

-p '{"shrink_polygons": "true"}' should be -p '{"shrink_polygons": true}' or simply -P shrink_polygons true. The latter will already try to do type casting (although in a limited fashion).

Anyway, this is not a ocrd_tesserocr issue, it belongs to core. But see OCR-D/core#950 for the problems that casting can cause.

@MehmedGIT
Copy link
Author

Thanks for referencing 950. That helps to understand why a certain decision was made regarding parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants