os.environ doesn't show all environmental variables in Jupyter notebook
<p>I am finding that the following code prints out my expected environmental variable when I execute the script in a shell:</p>

<pre><code>import os
print(os.environ['STUFF'])
</code></pre>

<p>However, when I run this same code in Jupyter Notebook, I get a key error. I have tried restarting the Jupyter server. What else should I do?</p>

<p>You can query all the dictionary keys to confirm the one you have is not there.</p>

<pre><code>import os
print(os.environ.keys())
</code></pre>

<p>Or better you can test for the presence of the specific key.</p>

<pre><code>print(os.environ.has_key('STUFF'))
</code></pre>

python environment-variables