-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Elf Class error when trying example python on raspberry pi 4 #306
Comments
I'm experiencing the same issue with a fresh install of Bookworm on a raspberry pi zero W. Linux raspberrypi 6.1.0-rpi4-rpi-v6 #1 Raspbian 1:6.1.54-1+rpt2 (2023-10-05) armv6l Traceback (most recent call last): |
Similar error on raspberry pi 4, last version of Raspberry pi os: |
Similar issue on Raspberry Pi B+ running Raspbian 32bits It seems that the |
But if you see
|
Lines 233-241 seem to be the answer to why it's getting the wrong system: JetsonNano is the else condition. It's not finding what it expects to at the path used to check that the code is being run on a raspberry pi. |
I can confirm that on Raspberry Pi 4 with Raspberry Pi OS 64 bits, that file doesn't exist: |
I changed my epdconfig.py by cutting the path back to '/sys/bus/platform/drivers' so that it would at least proceed using the Rasberry Pi code. A new error appears! (kindof... I'll explain after the Traceback) INFO:root:epd2in13g Demo This is the same error I was seeing when running the same code on a freshly installed and prepared image of Bullseye (with an unmodified epdconfig.py). Bookworm removed the driver, but there's still another underlying problem. It's worth noting that the C demo code works flawlessly on both. Unfortunately, I don't speak C. |
Found the missing piece of the puzzle. The python demo now runs for me without issue. To summarize the changes made: At line 233 of At line 94 of At line 96 of |
What python version are you using? |
I'm using Python 3.11.2
That is much more elegant. Thank you. |
Unfortunately this seems to break my project as I have been referencing this repo as a module, to allow users to use different Waveshare displays. To be specific, using it with the October 10th Raspberry Pi OS. It's also not limited to Raspberry Pi 4, it does happen on Raspberry Pi Zero, Zero two, etc. It would be appreciated if a waveshare team member could give some attention to this issue and implement a more reliable fix on the epdconfig instead, so users don't have to edit a file to get the waveshare code working with latest Raspberry Pi OS. Sorry not sure who that would be @SSYYL @kmanc @waveshareteam ? |
For reference, here is how Adafruit detect Raspberry Pi: https://github.com/adafruit/Adafruit_Python_GPIO/blob/a12fee39839665966bd124fd22588b2c87ced9d2/Adafruit_GPIO/Platform.py#L84-L113 This thread has some useful suggestions too, looking for the Or looking for the existence of the |
Write them via Email, they dont look here very often - but via Email you get near instant answers. |
@jcolladosp yeah, I don't get that either but was throwing me off for a bit as I thought SPI wasn't active (and it wasn't since I was using NixOS) but switching to Rpi OS (bookworm) also threw this error with SPI enabled and rebooted...so I just commented out the bits (basically your suggestion from above) that were trying to load up the JetsonNano stuff and 🎉 it works like a dream - using an older RPi 3 |
Thanks man, it saves my day ! |
When I run the python example on a fresh up to date raspbian install on Raspberry Pi4 I get the following error
Traceback (most recent call last):
File "/home/pi/shared/e-Paper/RaspberryPi_JetsonNano/python/examples/epd_2in7b_test.py", line 11, in
from waveshare_epd import epd2in7b
File "/home/pi/shared/e-Paper/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7b.py", line 32, in
from . import epdconfig
File "/home/pi/shared/e-Paper/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epdconfig.py", line 238, in
implementation = JetsonNano()
^^^^^^^^^^^^
File "/home/pi/shared/e-Paper/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epdconfig.py", line 116, in init
self.SPI = ctypes.cdll.LoadLibrary(so_filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/init.py", line 454, in LoadLibrary
return self._dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/init.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: /home/pi/shared/e-Paper/RaspberryPi_JetsonNano/python/lib/waveshare_epd/sysfs_software_spi.so: wrong ELF class: ELFCLASS64
The text was updated successfully, but these errors were encountered: