dlenski / python-zxing

python wrapper for the ZXing barcode library
GNU Lesser General Public License v3.0
123 stars 37 forks source link

Fails when passing pathlib.Path object #35

Open stefan6419846 opened 6 months ago

stefan6419846 commented 6 months ago

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

https://github.com/dlenski/python-zxing/blob/ea517d0a7326b12a8a7492d3a0c73513c46a6ef5/zxing/__init__.py#L72-L76 seems to be incomplete and probably should check for the inverse, id est for known iterables.

dlenski commented 6 months ago

seems to be incomplete and probably should check for the inverse, id est for known iterables

Want to submit a PR to do it this way instead?