inheriting console environment Follow
hi all..
Apologies if this is a FAQ, but i would like to inherit my console environment when i run PyCharm. Is this possible, or, if not, is there an easy way to pull the environment variables into a run/debug configuration?
thanks!
Please sign in to leave a comment.
Hello David,
The only way for PyCharm to see the environment variables defined in your
console environment (in files like .bash_profile) is to run PyCharm from
the console.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
The reason i ask is because the Run/Debug Configuration screen is prompting for individual environment variables. I haven't seen the option (checkbox?) where it just pulls the environment from the console used to launch pycharm.. this would be Quite Nice because our workflow is heavily dependent on creating consoles with specific environment variables for specific applications. If this isn't supported out-of-the-box, perhaps there is a way to programmatically add the environment variables into the Run/Debug environment or specify them via a text file generated by running env in the console?
Hello David,
The checkbox is there, and enabled by default. Click the ... button to the
right of the environment variables field; the "Include parent environment
variables" checkbox is at the bottom.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Well.. something is wrong with the way i'm doing things, then. If i run the python file with this checkbox left checked then the console shows an error which indicates an import library is not found. If i explicitly add the PYTHONPATH variable and copy the value from the console $PYTHONPATH string in the console used to launch pycharm then it does find the import libraries. I am also able to run the python file completely from the commandline, but it fails when launched using the debugger.. which leads me to wonder whether other environment variables aren't being found.
If i put this at the top of the file i'm debugging i see:
import os
for param in os.environ.keys():
print "%20s %s" % (param,os.environ[param])
after the os import then i see:
PYTHONPATH /data/app/cent5_i386/PyCharm/1.2.0/helpers:/data/home/aikend/workspace/CharacterBundler
so it seems the PYTHONPATH is significantly different from that of the console which launched pycharm.