Troubles with external Python modules for SPI communication

Started by analog_dreams, December 28, 2021, 03:06:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hi everyone! :)
This is my first post :D
I need to read an adc (MCP3008) in my GeeXLab scene running on a Raspberry Pi 4.
To do so, I tried using several python modules (spidev, mcp3008, Wiring Pi for python), but as soon as I add an import of one of those external modules in the file I get an error.
However, if I try to import other built-in modules (such as sys, or os), everything goes smoothly.
When I run the init script from the Thonny IDE, all the imports work correctly, the issue appears only when I launch it in the GeeXLab scene.
Does GeeXLab allow for the use of external modules? Am I missing something obvious?


I don't know if it will work, but Have you tried to set the environment PYTHONPATH:
os.environ["PYTHONPATH"]=PATH to search for py modules
A simple example: