title: Environment Variables when script run by cron
body: <p>I have a Python script which uses environment variables. This script works exactly as planned when run directly; however, I would like to run it as a cron job every minute for the time being.</p>
  <p>Currently in my <code>cron.</code> directory I have a file called <code>scrapers</code> containing:</p>
  <pre><code>* * * * * root /usr/bin/python3.5 /code/scraper.py
  </code></pre>
  <p>This runs the Python script but the script fails, as in the script I use two environment variables.</p>
  <p>I read I should add <code>SHELL=/bin/bash</code> to the cron file, so I did, but this didn't help.</p>
  <pre><code>SHELL=/bin/bash
  * * * * * root /usr/bin/python3.5 /code/scraper.py
  </code></pre>
  <p>Then I read</p>
  <blockquote>
  <p>In the crontab, before you command, add <code>. $HOME/.profile</code>.</p>
  </blockquote>
  <pre><code>SHELL=/bin/bash
  * * * * * . $HOME/.profile; root /usr/bin/python3.5 /code/scraper.py
  </code></pre>
  <p>but this caused the cron to stop running altogether. What is the best way of 'sending' the env variables to the cron?</p>