Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105519

Re: Obtain the variable in bash.

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Obtain the variable in bash.
Date 2016-03-23 18:19 +1100
Message-ID <mailman.32.1458717548.2244.python-list@python.org> (permalink)
References <nctfkg$kt7$1@aspen.stu.neva.ru>

Show all headers | View raw


On Wed, Mar 23, 2016 at 6:12 PM, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> I exported a variable in my .bashrc as follows:
>
> export MY_VAR="fdsfads"
>
> Then I soured the .bashrc and do the testing as follows:
>
> werner@debian-01:~$ python -c "import os; print os.environ['MY_VAR']"
> fdsfads
>
> But, when I run the same commands in pycharm and wing ide, I failed the
> obtain the value of this variable.
>
> I'm very confused with this issue.
>

Did you start pycharm/wing from the same session in which you sourced
.bashrc? If not, they won't see that change.

My guess is that you started the IDEs from your GUI in some way (the
Applications menu or something). If that's the case, they'll inherit
their environment from your GUI. You _may_ be able to have them
"notice" your change to .bashrc by logging out and in again, or
rebooting; it depends how your system is configured.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Obtain the variable in bash. Hongyi Zhao <hongyi.zhao@gmail.com> - 2016-03-23 07:12 +0000
  Re: Obtain the variable in bash. Chris Angelico <rosuav@gmail.com> - 2016-03-23 18:19 +1100
    Re: Obtain the variable in bash. Hongyi Zhao <hongyi.zhao@gmail.com> - 2016-03-23 08:35 +0000
      Re: Obtain the variable in bash. Chris Angelico <rosuav@gmail.com> - 2016-03-23 19:45 +1100
  Re: Obtain the variable in bash. Ben Finney <ben+python@benfinney.id.au> - 2016-03-23 19:08 +1100

csiph-web