I have driver scripts and Python libraries that are siblings:
/home/mydir/pythonProjs/
In driver.py , I have a line:
from lib import method1
On my command line on Linux, the following is successfully executed:
python /home/mydir/pythonProjs/driver.py
But when I try the following in crontab:
10 1 * * * export PYTHONPATH=~/mydir/pythonProjs; python /home/mydir/pythonProjs/driver.py
I get an error message:
ImportError: No module named lib.method1
I also tried changing the path parameter in my crontab command to the fully qualified path /home/mydir/pythonProjs , omitting the "export", and also trying to write .sh files (with the necessary #! Bin / bash ...)
I have one main question and the following question: main: What is the best way to fix my problem? continued: What is the philosophy behind cron with a different path access than my shell?
Before I went down, they voted too quickly, I mentioned that I read, but was not successful (or correctly disassembled) the following: - Where can I set environment variables that crontab will use? - Problems with crontab with running python - http://pythonadventures.wordpress.com/2012/03/31/calling-a-python-script-from-crontab/
Quetzalcoatl Sep 02 '14 at 23:07 2014-09-02 23:07
source share