About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Register or Sign In

ADC Pi and python3

582 Views - Created 21/03/2018


Posted by:

Users Avatar

I have a functional python3 program to read the values of my ADC pi board. I want to autoload it using crontab. I can run the program manually by simply typing python3 Loopback.py but  trying to run it from crontab it get an import module error in python. Presumably because crontab runs as root not as pi user. What might be the solution to this?


Posted by:

Users Avatar

United Kingdom

Users Twitter  Users Website  

Have you installed the python library using the setup.py script, or are you using the adcpi.py library in the same folder as your script?  If you have installed it then it could be a problem with crontab not knowing where to look for the python modules.

I found this page on stackoverflow with someone who had the same problem as you are having and a few answers that may work.  It looks like you may need to define the python path in crontab in order for it to import the module.

AB Electronics UK Tech Support

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.