Can a driver be added to Python just by copying the appropriate directory and files (on a Raspberry Pi)? All the info I found uses a script or pip to install but those end in an error such as upper module unknown or just don't work.
The driver is for the Waveshare 2 inch OLED (https://www.waveshare.com/wiki/2inch_LCD_Module).
The installation procedure installs (using proper methods) wiringPi, RPi.GPIO, and spidev so I expect those are OK.
The actual OLED driver files (C and py dirs) however are installed under /home/andy/bcm2835-1.71/WiringPi/LCD_Module_RPI_code/RaspberryPi/python/lib and the C is then recompiled.
The py examples work if run from their directories but which directories & files need to be copied into the actual python3.9 tree so they're known and available to new projects, in the right (new?) sub-dirs and not just dumped in where they happen to work?
update: The project can be made to work by adding the path but it seems like a messy hack.
sys.path.append("..")
sys.path.append("/home/andy/bcm2835-1.71/WiringPi/LCD_Module_RPI_code/RaspberryPi/python/")
# import LCD_2inch
from lib import LCD_2inch
Tried several installation methods, pip install and with path name.
Best answer seems to be from "ghp" on the raspberrypi forum. Copy the lib folder of the driver into the application folder structure, the sys.path.append used int in the demo code can be removed, and the entire project including the specific drivers required are all together.
Never manually copy drivers into the python /lib or subdirs of /lib since they will disappear if/when you update Python.
https://forums.raspberrypi.com/viewtopic.php?p=2083101#p2082883