Hongyi Zhao <hongyi.z...@gmail.com> 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 you're doing is two quite separate steps: * Obtain a collection of items (key → value pairs). * Update a dictionary. Please be clear that's what you're doing because “update ‘os.environ’ with ‘subprocess.Popen’ is *not* that. > 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 <module> > os.environ.update(line.partition('=')[::2] for line in output.split > ('\0')) > AttributeError: 'Popen' object has no attribute 'split' > ------------------- So your problem is nothing to do with “update ‘os.environ’”. I have updated the Subject field accordingly. The problem you're encountering is only to do with ‘subprocess.Popen’. That should make it much easier to search for the documentation to understand the problem. <URL:https://docs.python.org/3/library/subprocess.html#subprocess.Popen.stdout> -- \ “When people believe that they have absolute knowledge, with no | `\ test in reality, this [the Auschwitz crematorium] is how they | _o__) behave.” —Jacob Bronowski, _The Ascent of Man_, 1973 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list