Replace use of popen2

popen2 is deprecated, replaced with subprocess.popen