Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have added to the PYTHONPATH on my server's .bash_profile file. However it appears that cron isn't reading from it because I am getting import errors. If I run the exact command cron calls on the command line it works, but if I send the error output of cron to a separate file, its failing on the imports.

how can I structure it so that cron is aware of my appended PYTHONPATH

share|improve this question
up vote 9 down vote accepted

cron doesn't read shell startup files. You need to explicitly set the environment you need in the crontab or in the script that is being run. You can place variable assignment statements directly in the crontab:


Each directory you need will have to be listed, because you can't append to it since the previous value isn't available.

share|improve this answer

Include at the begining of the script.

. [directorypath].bash_profile
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .