robweber / omni-epd

An EPD (electronic paper display) class abstraction to simplify communications across multiple display types.
GNU General Public License v3.0
83 stars 19 forks source link

Waveshare 7.8 display #75

Closed tkameroski closed 2 years ago

tkameroski commented 2 years ago

I have been running SlowMovie player on a 7.5 inch Waveshare display but wanted to try it on the 7.8. the only change I made was to set epd = waveshare_epd.it8951 and remove the other epd display from the conf file. When I run the program nothing displays on the 7.8 and I get the following;

Traceback (most recent call last): File "/home/pi/SlowMovie/slowmovie.py", line 251, in epd = displayfactory.load_display_driver(args.epd) File "/home/pi/.local/lib/python3.9/site-packages/omni_epd/displayfactory.py", line 113, in load_display_driver result = classObj(deviceType[1], config) File "/home/pi/.local/lib/python3.9/site-packages/omni_epd/displays/waveshare_display.py", line 404, in init self._device = deviceObj.AutoEPDDisplay(vcom=self._getfloat_device_option('vcom', -2.06), File "/home/pi/.local/lib/python3.9/site-packages/IT8951/display.py", line 227, in init AutoDisplay.init(self, self.epd.width, self.epd.height, **kwargs) File "/home/pi/.local/lib/python3.9/site-packages/IT8951/display.py", line 26, in init self._set_rotate(rotate, mirror) File "/home/pi/.local/lib/python3.9/site-packages/IT8951/display.py", line 69, in _set_rotate 'CW' : Image.Transpose.ROTATE_270, File "/home/pi/.local/lib/python3.9/site-packages/PIL/Image.py", line 65, in getattr raise AttributeError(f"module '{name}' has no attribute '{name}'") AttributeError: module 'PIL.Image' has no attribute 'Transpose'

Any ideas what is going wrong?

thanks, Tom

robweber commented 2 years ago

What version of Pillow do you have? It looks like starting in version 9.1 a bunch of stuff was deprecated.

https://pillow.readthedocs.io/en/latest/releasenotes/9.1.0.html#constants

It could just be we need to pin a specific version of the package.

tkameroski commented 2 years ago

I had pillow 9.0.1 installed. uninstalled it and installed 8.4.0 but got the same error but when I installed 9.2.0, it worked.

robweber commented 2 years ago

Did you, by chance, also update other packages when you did this? I see in the IT8951 package it's now using the new variables (post Pillow 9.1) instead of the ones referenced in the stack trace you had above. If you look at the link it's the same line as the one that threw the error but now the variable names have changed. If I had to guess I bet when you downgraded the IT8951 package had the updated names and when you upgraded again everything matched.

tkameroski commented 2 years ago

I did a fresh install using the bash script from SlowMovie, edited the conf file and got the error. I then connected a 7.5 display and exited the conf file and it worked with that display. I reconnected the 7.8 display, uninstalled Pillow 9.0.1 and installed Pillow 8.4.0 and got the same error. Finally I uninstalled 8.4.0 and installed 9.2.0 and it worked. No idea how or why. I didn’t update, reinstall or change the IT8951 package or any others unless Pillow updated another dependent when installing.

robweber commented 2 years ago

Ok - thanks for the explanation. That all makes sense based on the code I'm seeing. Basically - from what I can tell:

  1. Fresh install got Pillow 9.0.1
  2. 7.8 in throws an error as the IT8951 __init__ method contains calls containing Pillow 9.1.0 variables
  3. 7.5 in works as it's not accessing that codebase
  4. Downgrade to 8.4.0 has the same problem, The IT8951 code expects Pillow 9.1.0 or above
  5. Upgrade to 9.2.0 finally works

I mistakenly transposed 9.0.1 for 9.1.0 when I gave you that link yesterday thinking the IT8951 package was using the old Pillow code. Ironically the issue was the same as it was updated for the new Pillow versions you just had an old one. The more I look at this there are aspects of omni-epd that will need to be updated to avoid similar errors.