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


Groups > comp.lang.python > #105519

Re: Obtain the variable in bash.

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Obtain the variable in bash.
Date Wed, 23 Mar 2016 18:19:04 +1100
Lines 26
Message-ID <mailman.32.1458717548.2244.python-list@python.org> (permalink)
References <nctfkg$kt7$1@aspen.stu.neva.ru>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de zzbzxkrp50c2UDHmvensCA5R7AFkVjfcGFplONGYxaEg==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'cc:addr:python-list': 0.09; 'os;': 0.09; 'python': 0.10; 'wed,': 0.15; '2016': 0.16; '23,': 0.16; 'exported': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ides': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:variable': 0.16; 'variable.': 0.16; 'wing': 0.16; 'wrote:': 0.16; 'gui': 0.18; 'variable': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'issue.': 0.20; '(the': 0.22; 'not,': 0.22; 'header:In-Reply- To:1': 0.24; 'testing': 0.25; 'logging': 0.27; 'message- id:@mail.gmail.com': 0.27; "they'll": 0.29; 'environment': 0.29; "i'm": 0.30; 'print': 0.30; 'guess': 0.31; 'run': 0.33; 'case,': 0.34; 'received:google.com': 0.35; 'follows:': 0.35; 'received:209.85': 0.36; 'depends': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; "won't": 0.38; 'received:209': 0.38; 'skip:o 20': 0.38; 'subject:the': 0.39; 'some': 0.40; 'your': 0.60; 'export': 0.63; 'mar': 0.65; 'inherit': 0.66; 'chrisa': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=07w3/9rt9wkJHYIgLxNS6SuvO8vbVemHfa6GzWlCbUg=; b=Hv2C6+sqcbRLuzpnFpOQr84qFKWRw8GBsCz4+LbDrWrAnW6PXosEgj2/YvVDd5ohRJ owdrFkGT0/1yo9mei5G3d5XljCCcZyEELNPAwHecCWzAJ+bPVQCgBaItl83SZk3D74Ej yOWK5dWxQc3dtXw2Cnrp36r2YoKDyPmPZBwFqZOmNf6tlUpK4wehn4rLOgsZF/5kzS1f 6fZSF20cQpSyWfvCuz0jbnRAQb9u2sZeh6euSDJy3mQMDvxMkphOWeHUPNGLogA/VZRI zAww9gUnozkUuNYeU4RHOcSz2aV5uqYJMfWhhKyiY8yrsB7CjzLaZK0u6KGBQAt8x4Ol nSKg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=07w3/9rt9wkJHYIgLxNS6SuvO8vbVemHfa6GzWlCbUg=; b=KDi/k+qiX9D2DSf6qJEEirkmlNh0PBTr3WRfJVbta1QuuZuU0plQPag7/u37hD6o54 llZMUuyoxqK8ELEXdwrVnyj9rMdb0W5mu2ZAq/FGurt+IiGb46K764qxpYc+WwRNIyLr G9tAwLzpGnxhJFhkWBsTNLRWDjKAsHqqf6TOp6lMsCDUD8f/OmrGeKN35DeeGv+VoLgd NWdxSysRv9pPoKd/fquepDMv/8uTjHmMvctrhO/Vx+Um2V9iYOBRIT2eD+FswtMsLZBm ybDOeNTUAf42eqiESUk/+G/MrDvTCqy/lE3mdsoh1SdTSB2voFOcEL78aS4HYakuReeR jv0w==
X-Gm-Message-State AD7BkJKkoLl9yrPb9q8w17nwXtxWODdPy2sLdvINPWCWal/hYTIh+tjzFkcUwzun7kWei5b3pAUG04EPGtsKzQ==
X-Received by 10.50.28.105 with SMTP id a9mr7368365igh.94.1458717544719; Wed, 23 Mar 2016 00:19:04 -0700 (PDT)
In-Reply-To <nctfkg$kt7$1@aspen.stu.neva.ru>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:105519

Show key headers only | 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