Re: Failed to update the os.environ with subprocess.Popen.

2016-04-03 Thread Cameron Simpson
On 03Apr2016 11:24, Hongyi Zhao wrote: On Sun, 03 Apr 2016 18:20:31 +1000, Cameron Simpson wrote: In particular, you want the subprocess' output. As written, your code sets "output" to the Popen object. You actually want to set it to the .stdout attribute of that object, which is the output fr

Re: Failed to update the os.environ with subprocess.Popen.

2016-04-03 Thread Hongyi Zhao
On Sun, 03 Apr 2016 18:20:31 +1000, Cameron Simpson wrote: > In particular, you want the subprocess' output. As written, your code > sets "output" to the Popen object. You actually want to set it to the > .stdout attribute of that object, which is the output from the > subcommand. Based on your a

Re: Failed to update the os.environ with subprocess.Popen.

2016-04-03 Thread Cameron Simpson
On 03Apr2016 14:24, Steven D'Aprano wrote: On Sun, 3 Apr 2016 01:29 pm, Hongyi Zhao wrote: I use the following code to update the os.environ with subprocess.Popen: I don't understand what you are trying to do here. But regardless of your intention, the problem you have is nothing to do with u

Re: Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Steven D'Aprano
On Sun, 3 Apr 2016 01:29 pm, Hongyi Zhao wrote: > Hi all, > > I use the following code to update the os.environ with subprocess.Popen: I don't understand what you are trying to do here. But regardless of your intention, the problem you have is nothing to do with updating os.environ. Proof: chan

Re: Get the output from a Popen instance (was: Failed to update the os.environ with subprocess.Popen.)

2016-04-02 Thread Hongyi Zhao
On Sun, 03 Apr 2016 13:37:24 +1000, Ben Finney wrote: >> But, I meet the following errors: >> >> >> Traceback (most recent call last): >> File "/home/werner/software/hpc/dft-to-study/jasp/jasp.git/jasp/bin/ >> runjasp.py", line 125, in >> os.environ.update(line.partition('=')[:

Get the output from a Popen instance (was: Failed to update the os.environ with subprocess.Popen.)

2016-04-02 Thread Ben Finney
Hongyi Zhao writes: > I use the following code to update the os.environ with > subprocess.Popen Again, it is quite misleading to describe what you are doing as “update the os.environ with subprocess.Popen”. The ‘subprocess.Popen’ call *cannot* upsdate the Python process's ‘os.environ’. What yo

Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Hongyi Zhao
Hi all, I use the following code to update the os.environ with subprocess.Popen: - from subprocess import Popen output = Popen(""" /bin/bash < os.environ.update(line.partition('=')[::2] for line in output.split ('\0')) AttributeError: 'Popen' object has no attribute 'split' -

Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Hongyi Zhao
Hi all, I use the following code to update the os.environ with subprocess.Popen: - from subprocess import Popen output = Popen(""" /bin/bash < os.environ.update(line.partition('=')[::2] for line in output.split ('\0')) AttributeError: 'Popen' object has no attribute 'split' -

Failed to update the os.environ with subprocess.Popen.

2016-04-02 Thread Hongyi Zhao
Hi all, I use the following code to update the os.environ with subprocess.Popen: - from subprocess import Popen output = Popen(""" /bin/bash < os.environ.update(line.partition('=')[::2] for line in output.split ('\0')) AttributeError: 'Popen' object has no attribute 'split' -