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

TypeError: argument of type 'NoneType' is not iterable #47

Closed
mikegerber opened this issue Oct 22, 2020 · 3 comments
Closed

TypeError: argument of type 'NoneType' is not iterable #47

mikegerber opened this issue Oct 22, 2020 · 3 comments

Comments

@mikegerber
Copy link
Member

With this input (full workspace: qurator-spk/sbb_binarization#8 (comment)):

<?xml version="1.0" encoding="UTF-8"?>
<pc:PcGts xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15 http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15/pagecontent.xsd" pcGtsId="OCR-D-IMG-BIN_00000024">
    <pc:Metadata>
        <pc:Creator>OCR-D/core 2.18.1</pc:Creator>
        <pc:Created>2020-10-22T18:49:34.729618</pc:Created>
        <pc:LastChange>2020-10-22T18:49:34.729618</pc:LastChange>
        <pc:MetadataItem type="processingStep" name="preprocessing/optimization/binarization" value="ocrd-sbb-binarize">
            <pc:Labels externalModel="ocrd-tool" externalId="parameters">
                <pc:Label value="/var/lib/sbb_binarization" type="model"/>
                <pc:Label value="page" type="operation_level"/>
            </pc:Labels>
        </pc:MetadataItem>
    </pc:Metadata>
    <pc:Page imageFilename="OCR-D-IMG/OCR-D-IMG_00000024.tif" imageWidth="2463" imageHeight="4060">
        <pc:AlternativeImage filename="OCR-D-IMG-BIN/OCR-D-IMG-BIN_00000024.IMG-BIN.png"/>
    </pc:Page>
</pc:PcGts>

I get:

18:52:44.963 INFO processor.OcrdSbbTextlineDetectorRecognize - INPUT FILE 0 / <OcrdFile fileGrp=OCR-D-IMG-BIN, ID=OCR-D-IMG-BIN_00000024, mimetype=application/vnd.prima.page+xml, url=OCR-D-IMG-BIN/OCR-D-IMG-BIN_00000024.xml, local_filename=OCR-D-IMG-BIN/OCR-D-IMG-BIN_00000024.xml]/> 
Traceback (most recent call last):
  File "/usr/local/bin/ocrd-sbb-textline-detector", line 8, in <module>
    sys.exit(ocrd_sbb_textline_detector())
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/qurator/sbb_textline_detector/ocrd_cli.py", line 32, in ocrd_sbb_textline_detector
    return ocrd_cli_wrap_processor(OcrdSbbTextlineDetectorRecognize, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/ocrd/decorators/__init__.py", line 81, in ocrd_cli_wrap_processor
    run_processor(processorClass, ocrd_tool, mets, workspace=workspace, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/ocrd/processor/helpers.py", line 68, in run_processor
    processor.process()
  File "/usr/local/lib/python3.6/dist-packages/qurator/sbb_textline_detector/ocrd_cli.py", line 67, in process
    feature_filter='binarized,grayscale_normalized'
  File "/usr/local/lib/python3.6/dist-packages/ocrd/workspace.py", line 423, in image_from_page
    for feature in feature_filter.split(',') if feature)):
  File "/usr/local/lib/python3.6/dist-packages/ocrd/workspace.py", line 423, in <genexpr>
    for feature in feature_filter.split(',') if feature)):
TypeError: argument of type 'NoneType' is not iterable

@kba Might be a bug in OCR-D/core?

@mikegerber
Copy link
Member Author

I believe it's due to the missing AlternativeImage/@comments qurator-spk/sbb_binarization#8, but I could be wrong.

@kba
Copy link
Contributor

kba commented Oct 26, 2020

Both the underlying issue qurator-spk/sbb_binarization#8 and core not being able to handle AlternativeImage without comments should be fixed.

@mikegerber
Copy link
Member Author

I guess this can be closed.

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