title: Python script works manually, but not from cron job
body: <p>I have a Python script that gets a piece of data from an environment variable like so:</p>
  
  <pre><code>password = os.environ["SomePassword"]
  </code></pre>
  
  <p>The script works as expected when I run it manually, however when the script is in a shell file and run by a cron job it fails on that line with a "KeyError", which I assume is it not finding the variable.</p>
  
  <p>Also, when I run any of the below as the same user that runs the cron job, I see the variable as expected.</p>
  
  <pre><code>echo $SomePassword
  env
  printenv
  </code></pre>
  
  <p>What's going on and how do I resolve this?</p>
  
  <p><strong>UPDATE:</strong>
  I was able to resolve this by reading the suggested duplicate question - however, that question does not describe the root issue, which may be of interest to others.</p>