Are you running in a Python Virtual Environment? If not then by running under SUDO Python looks at system rather than user Python modules you've installed with PIP.But then when I ran sudo (as I need to use sudo for some other stuff later on), the code would immediately stop.
As someone else mentioned, don't pipe to /dev/null and you will likely see Import errors.
Personally, I would investigate putting your project into a Virtual Environment so you only need to load the modules one. I would explore what it means to run SUDO under that.
Try Posting to the Python Forum https://forums.raspberrypi.com/viewforum.php?f=32
Statistics: Posted by DS256 — Mon Jun 24, 2024 7:02 pm