inheriting console environment

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!

5 comments
Comment actions Permalink

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.

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?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

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?

0
Comment actions Permalink

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.

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?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0

Please sign in to leave a comment.