hey guys, im trying to run a python script after every 5 minutes using cron, inside the script is a django import
import django
when running the crontab i get mailed the following error
ImportError: No module named django
this is what the crontab file looks like:
[email protected]
*/5 * * * * /usr/bin/python /Users/paulo/Desktop/ashtanga/ping/sender.py
do anyone of you know whats causing this ? btw i do have django insalled version 1.2, python 2.6, and MacOX 10.6
EDIT:
$PYTHONPATH = isn't this the same as which python
python -v =
Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
which python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
I want to addd one point to @Hank's answer.
cron doesn't have all the environment variables set as in the shell you use. Only LOGNAME, HOME, and SHELL are defined. (You can refer to "man 5 crontab" for more info.)
You can define PYTHONPATH environment variable in cron just as the way you defined MAILTO. So no shell wrapper is needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With