I have a python script that works fine when run from the command line. I need the script to run at boot time, however, I get a TinyDB not found error. I thought it was a path issue so I wrote a small bash script that did a cd to the home directory where TinyDB is installed and then executed the script. Same error.
Putting this in rc.local:
/home/pi/sub-mqtttest2.py >> /home/pi/mylog.log 2>&1
Generates this error:
Traceback (most recent call last): File "/home/pi/./sub-mqtttest2.py", line 20, in <module> from tinydb import TinyDB, Query ModuleNotFoundError: No module named 'tinydb'
This is how I am importing it into my code:
from tinydb import TinyDB, Query
Is there a way to install TinyDB system-wide so it can be imported regardless of where the python script is?
UPDATE: Installing as root solves the issue of loading TinyDB at boot time.