Skip to content

Issue with blank images #14

Description

@mcm246

Hi! Thanks for your work on this package, it's awesome!

I've been running into an issue with some "images" where the program crashes at line 119 while trying to iterate over the OCR results. It seems like the 'success' variable is returning true even though there were no results available. I've pasted the program output below as well as a sample image which you should be able to use to reproduce the issue. A quick fix could be to check to confirm that there actually are results alongside the 'success' check in line 118 (although what's confusing to me is that I've tested this on some other blank images that correctly returned an empty list as expected...).

Traceback (most recent call last): File "[...]/test.py", line 72, in <module> annotations = ocrmac.OCR('/blank_image.png').recognize() File "[...]/lib/python3.9/site-packages/ocrmac/ocrmac.py", line 158, in recognize res = text_from_image( File "[...]/lib/python3.9/site-packages/ocrmac/ocrmac.py", line 119, in text_from_image for result in req.results(): TypeError: 'NoneType' object is not iterable

Blank image example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions