import xml.etree.ElementTree as ET
import subprocess
cmd = ". /local/export/sge/default/common/settings.sh; qstat -xml"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = p.communicate()
stdout
'\n\n \n \n \n \n 14233\n 0.55500\n test_pour_solvqual_addd34936bfc2b3c5f0c54720234b5cd\n me\n qw\n 2011-12-23T08:44:23\n \n 1\n \n \n\n'
xml = ET.parse(stdout)
Traceback (most recent call last):
File "", line 1, in
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py", line 862, in parse
tree.parse(source, parser)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py", line 579, in parse
source = open(source, "rb")
IOError: [Errno 2] No such file or directory: '\n\n \n \n \n \n 14233\n 0.55500\n test_pour_solvqual_addd34936bfc2b3c5f0c54720234b5cd\n me\n qw\n 2011-12-23T08:44:23\n \n 1\n \n \n\n'