rm-hull / luma.oled

Python module to drive a SSD1306 / SSD1309 / SSD1322 / SSD1325 / SSD1327 / SSD1331 / SSD1351 / SH1106 OLED
https://luma-oled.readthedocs.io
MIT License
801 stars 161 forks source link

SSD1322: Python 3.7 to 3.9-3.11 upgrade fail #320

Open majuss opened 3 years ago

majuss commented 3 years ago

Hi guys, I'am in the process of upgrading my project from Python 3.7 to 3.9 but the Luma.oled library is spazzing out.. In the attached picture you see a scrolling text. With 3.7 everything works fine but with Python 3.9 the scrolling text is completely broken. Minimal static examples all work.

RPI 3B+
5.4.79-v7+
Version: luma.oled 3.8.1 (luma.core 2.2.0)
Python3.9.1 completely fresh venv

Package                          Version
-------------------------------- ---------
Adafruit-Blinka                  5.9.1
adafruit-circuitpython-bme280    2.5.1
adafruit-circuitpython-bme680    3.3.0
adafruit-circuitpython-busdevice 5.0.1
Adafruit-GPIO                    1.0.3
Adafruit-PlatformDetect          2.23.0
Adafruit-PureIO                  1.1.8
cbor2                            5.2.0
certifi                          2020.12.5
chardet                          3.0.4
Cython                           0.29.21
dbus-python                      1.2.16
Deprecated                       1.2.10
idna                             2.10
luma.core                        2.2.0
luma.oled                        3.8.1
mock                             4.0.3
pi-ina219                        1.3.0
pi-rc522                         2.2.1
Pillow                           8.0.1
pip                              20.3.2
pycairo                          1.20.0
pyftdi                           0.52.0
PyGObject                        3.38.0
pyserial                         3.5
python-lirc                      1.2.3
python-mpv                       0.5.2
pyusb                            1.1.0
requests                         2.25.0
rpi-ws281x                       4.2.5
RPi.GPIO                         0.7.0
setuptools                       49.2.1
smbus2                           0.4.0
spidev                           3.5
sysv-ipc                         1.0.1
urllib3                          1.26.2
wheel                            0.36.2
wrapt                            1.12.1
xmltodict                        0.12.0

Expected behaviour

Scrolling text without artifacts. Code can be found here: https://github.com/majuss/wladio/blob/master/radio/display.py

Actual behaviour

Scrolling text with haevy glitches.

The runner example is also broken, if I don't stretch it across the whole screen. index

index

I will update this issue with my findings.

thijstriemstra commented 3 years ago

can you doublecheck if the installed package versions for 3.7 vs 3.9 are the same?

majuss commented 3 years ago
luma.core                        2.2.0
luma.oled                        3.8.1
Pillow                           8.0.1

Just tested it with the same versions in Python3.7. No problems there.

rm-hull commented 3 years ago

Hi @majuss , which oled driver is it? I experienced some odd glitches recently with pillow > 7.1.2 & python 3.8 when using the ssd1309 driver. Could you try python 3.9 with pillow 7.1.2 and report back please?

majuss commented 3 years ago

I use a SSD1322 and no same glitches with 7.1.2.

thijstriemstra commented 3 years ago

smbus2 recently had a big update as well, but probably unrelated to glitches..

majuss commented 3 years ago

Tried again with most recent packages. Exactly the same :(

thijstriemstra commented 3 years ago

@majuss so it doesn't work with Pillow 8.x on Python 3.9 but Pillow 7.1.2 on Python 3.9 is ok? And Python 3.7 is always ok?

Tried again with most recent packages. Exactly the same :(

Please specify which ones and version nrs.

majuss commented 3 years ago

Python3.9 never works pillow version doesn't matter. Python3.7 is always okay.

rm-hull commented 3 years ago

Well the interesting thing here is that the tests target python 3.6, 3.7, 3.8 and 3.9, and while they generally substitute the interface (I2C / SPI) for a mock, they do check to make sure the correct sequence of bytes is being produced for all the different displays across all versions of Python (albeit on Ubuntu / intel rather than Raspian / arm)

So that leads me to the following questions:

Everything you've said (and not said so far) points to it being a local issue, so we really need to know more about your setup

majuss commented 3 years ago

I use the latest version of Raspbian on a RPI 3B+. Didn't tried Python3.8 yet. I installed Python directly from source.

majuss commented 3 years ago

I switched to a Pi 4 and now everything works with Python3.9

majuss commented 10 months ago

@rm-hull The exact same behaviour is back again with Python 3.11 latest raspberry pi os bookworm. I already freshly installed everything.

thijstriemstra commented 10 months ago

@majuss what version of Pillow are you using? Can you test with latest (10.1.0)?

majuss commented 10 months ago

Here you go: image

majuss commented 9 months ago

@thijstriemstra how can I debug this? Even the runner example etc. is showing these artefacts again :/

majuss commented 1 month ago

The pillow version doesnt matter. The bug is there even with 9.4

rm-hull commented 1 month ago

Can you reproduce it on other devices?