Problems receiving arguments on a subprocess
hidura at gmail.com
hidura at gmail.com
Wed Jan 26 18:27:31 EST 2011
Hello i am trying to make a subprocess that will have to send data as an
arguments and is executing the script but don't receiving anything.
Here is the code of the subprocess:
car = Popen(shlex.split(self.block.getAttribute('cmd')),
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
data =
car.communicate(str("<request>"+self.extract.getByAttr(self.block, 'name', 'args')[0].toxml()+"</request>").encode())
dataOut = data[0].decode()
log = data[1].decode()
print(dataOut)
if car.returncode < 1:
return dataOut.split('\n')
else:
print(log)
return log
Here is the code of the script:
"""
Created By: hidura
On Date: Jan 25, 2011
"""
from xml.dom.minidom import parseString
import os
import sys
class savCSS:
"""This class has to save
the changes on the css file.
"""
def __init__(self, args):
document = parseString(args)
request = document.firstChild
address = request.getElementsByTagName('element')[0]
newdata = request.getElementsByTagName('element')[1]
cssfl = open("/webapps/karinapp/Suite/"+address.getAttribute('value'), 'r')
cssData = cssfl.read()
cssfl.close()
dataCSS = ''
for child in newdata.childNodes:
if child.nodeType == 3:
dataCSS += child.nodeValue
nwcssDict = {}
for piece in dataCSS.split('}'):
nwcssDict[piece.split('{')[0]] = piece.split('{')[1]
cssDict = {}
for piece in cssData.split('}'):
cssDict[piece.split('{')[0]] = piece.split('{')[1]
for key in nwcssDict:
if key in cssDict == True:
del cssDict[key]
cssDict[key] = nwcssDict[key]
result = ''
for key in cssDict:
result += key+"{"+cssDict[key]+"}"
cssfl = open(cssfl.name, 'a')
cssfl.write(result)
cssfl.close()
if __name__ == "__main__":
print(sys.stdin.read())
savCSS(sys.stdin.read())
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110126/d86605c8/attachment.html>
More information about the Python-list
mailing list