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: change the last line from this complicated expression:
os.environ.update(line.partition('=')[::2] for line in output.split('\0'))
to this simple expression:
output.split('\0')
and you will get the same error. os.environ is irrelevant. Your problem is
only with Popen.
What makes you think that Popen objects have a split() method? They are not
documented as having this method:
https://docs.python.org/2/library/subprocess.html
https://docs.python.org/3/library/subprocess.html
https://pymotw.com/2/subprocess/
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list