Following the upgrade of a server machine to Ubuntu 16.04, all python programs started by cron fail upon the 'import pyodbc' statement. I installed that package normally via
pip3 install pyodbc
If I create a simple program containgin just the instruction 'import pyodbc'
, it works if i run it from the command line:
$ python3 /home/test.py
$
I instructed the same program to be run from cron (here is the relevant part of crontab):
$ crontab –l
0,5,10,15,20,25,30,35,40,45,50,55 8,10,12-18 * * * python3 /home/test.py 1>>/var/log/python3.log
Then, in the log file, I get:
Traceback (most recent call last):
File "/home/test.py", line 1, in <module>
import pyodbc
ImportError: No module named 'pyodbc'
The result is the same if I run from the 'main' cron or from a user crontab'. What can I do to solve the problem?
import pyodbc
. I edited the question to make it more visible.