OSX shell environment variables

Hi,

I'm trialing PyCharm, which looks excellent, however I can't get the system environment variables to come through in a debug session.

I noticed the "Include parent environment variables" checkbox in the Python Console options, but it doesn't do anything, and it unchecks after I press ok.

Any ideas?

Cheers,

Shane



Attachment(s):
Environment Variables.jpg
6 comments

Bump...?

Is there any way to get the bash environment into PyCharm?  If not, it's a show stopper for me.

0

This is not specific to PyCharm at all. If you run PyCharm from bash, it will see the environment variables defined in your bash profile. If you run it from the dock, it will only see the global environment variables defined in environment.plist: http://developer.apple.com/library/mac/#qa/qa1067/_index.html

0

Ok, so to avoid setting a global .plist, I thought I'd add the environment variables I wanted to the Run/Debug Configuration -> Environment Variables, however I'm not sure how to append/substitute variable names.

e.g. I want to be able to mimic this:

export PATH=$PATH:~/SomeNewPath

How can I do this?

Shane

0

I don't think this is possible at the moment. You're welcome to file a feature request at http://youtrack.jetbrains.net/

Also, depending on what you're trying to run, you may be able to write a wrapper script that would configure the environment and then run your original program.

0

Yeah, I agree with the wrapper idea.  I'll just make an env.py for debugging purposes only, which sets all the envars, then kicks off the main python class.

Thanks anyway, Dmitry.

Cheers,

Shane

0

If I understand correctly:

  • Console > Python Console > Environment Variables is only for the Python Console.
  • To expose environment variables when debugging under macOS, open PyCharm from the command line.
alias pycharm='open /Applications/PyCharm.app'
0

Please sign in to leave a comment.