Failed to update the os.environ with subprocess.Popen.
Hongyi Zhao
hongyi.zhao at gmail.com
Sat Apr 2 23:28:23 EDT 2016
Hi all,
I use the following code to update the os.environ with subprocess.Popen:
-------------
from subprocess import Popen
output = Popen("""
/bin/bash <<EOF
source ~/.profile.d/modules/modules.sh
export PATH=$MODULESHOME/../default/bin:$PATH
module add intel/parallel_studio_xe_2015
env -0
EOF
""", shell=True)
if "" in os.environ.data: del os.environ.data[""]
os.environ.clear()
os.environ.update(line.partition('=')[::2] for line in output.split('\0'))
-------------
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'
-------------------
How to solve this issue?
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
More information about the Python-list
mailing list