I have a job in my crontab to run a script (
/home/sys_bio/username/p35/bin/python3.5 -m qefunctional.qe.tests.prodprobe -p post -j test.json
* * * * * /home/sys_bio/username/tracer.sh >> /home/username/tracer.cron.txt
/home/sys_bio/username/p35/bin/python3.5: Error while finding spec for 'qefunctional.qe.tests.prodprobe' (<class 'ImportError'>: No module named 'qefunctional')
echo "Starting Tracer POST"
/home/sys_bio/username/p35/bin/python3.5 -m qefunctional.qe.tests.prodprobe -p post -j /home/sys_bio/username/test.json -d -v 2>/home/username/crontab.output
echo "Ending Tracer POST"
Including the path to bash shell might be needed:
* * * * * /bin/sh /home/sys_bio/username/tracer.sh >> ...
cron otherwise might not really know what to do.
The same principle also applies to what is included in your script. Using relative file names can fail since they are often not interpreted the same as if you were using your local interactive shell (eg):
It might be necessary to use the absolute paths (eg):
EDIT: It's apparent from the error generated by Python the issue is definitely path related. Python is trying to locate the module in the path
/home/sys_bio/username/p35/bin/python3.5 instead of two directories up in
/home/sys_bio/username/. The fix would be to
cd into the directory or by giving the absolute path to the module. By adding the following into the
Should allow the command following it to look for the module there instead of two levels down.