Skip to content

Fails when passing pathlib.Path object #35

@stefan6419846

Description

@stefan6419846

Passing a pathlib.Path object as the filenames parameter raises some error:

Traceback (most recent call last):
  File "/home/stefan/temp/run.py", line 57, in <module>
    print(reader.decode(path))
  File "/home/stefan/temp/venv/lib/python3.9/site-packages/zxing/__init__.py", line 80, in decode
    for fn_or_im in filenames:
TypeError: 'PosixPath' object is not iterable

if isinstance(filenames, (str, IOBase, Image) if have_pil else (str, IOBase)):
one_file = True
filenames = filenames,
else:
one_file = False
seems to be incomplete and probably should check for the inverse, id est for known iterables.

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