Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

ADC Pi and python3

1697 Views - Created 21/03/2018

21/03/2018

Posted by:
tectp

tectp 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?

21/03/2018

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew 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.

Sign in to post your reply

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.