apt-decoder icon indicating copy to clipboard operation
apt-decoder copied to clipboard

Changing PIL import to fix Image error

Open diegojuan opened this issue 5 years ago • 1 comments

apt.py is showing this error

jd@Juans-MacBook-Pro apt-decoder % python3 apt.py rs.wav rs1.pmng
Traceback (most recent call last):
 File "apt.py", line 100, in <module>
   apt.decode(outfile)
 File "apt.py", line 32, in decode
   image = PIL.Image.fromarray(matrix)
 File "/Library/Python/3.7/site-packages/PIL/__init__.py", line 42, in __getattr__
   raise AttributeError("module '{}' has no attribute '{}'".format(__name__, name))
AttributeError: module 'PIL' has no attribute 'Image'

To fix this, is recommended to import Image

import PIL.Image

This fix the error and the image can be properly generated

diegojuan avatar Jul 20 '20 16:07 diegojuan

@diegojuan I believe you will also need to touch line 31 to use Image instead of PIL.Image

zacstewart avatar May 31 '21 04:05 zacstewart