On Sun, 27 Mar 2016 13:24:05 +, Hongyi Zhao wrote:
> # replace env
> os.environ.clear()
I find another method which can solve this issue, ie., changing the above
code into the follows:
# ref : http://unix.stackexchange.com/questions/178522/unsetting-
environment-variable-with-an-empty-name
On Mon, Mar 28, 2016 at 12:24 AM, Hongyi Zhao wrote:
> # replace env
> os.environ.clear()
> os.environ.update(line.partition('=')[::2] for line in output.split('\0'))
>
> Traceback (most recent call last):
> File "/home/werner/anaconda2/lib/python2.7/site-packages/IPython/core/
> interactiveshel
On 27 Mar 2016 17:01, "Ben Finney" wrote:
>
> Hongyi Zhao writes:
>
> > I use the following code the update the os.environ:
> >
> > import os
> > from subprocess import check_output
> >
> > # POSIX: name shall not contain '=', value doesn't contain '\0'
> > output = check_output("source /home/wer
Hongyi Zhao writes:
> I use the following code the update the os.environ:
>
> import os
> from subprocess import check_output
>
> # POSIX: name shall not contain '=', value doesn't contain '\0'
> output = check_output("source /home/werner/env-intel-toolchains.sh;
> env -0", shell=True, e
Hi all,
Based on the methods here:
http://stackoverflow.com/questions/7040592/calling-the-source-command-
from-subprocess-popen/18897007#comment30954741_12708396
I use the following code the update the os.environ:
import os
from subprocess import check_output
# POSIX: name shall not contain '=