tags:

views:

25

answers:

2

I know we can call like this:

os.system("ant compile")

But how to know whether the ant task is successful or not?

And is there another way to invoke ant task?

A: 

Can you modify ant to return a success code and capture that in python in it's return?

http://www.dotkam.com/2008/10/24/getting-return-code-from-ant-in-shell/

Erik
it's a good and helpful article, but I want to get the return code from ant in python script instead of SHELL
Return it to the Shell, then take that into python : http://pydanny.blogspot.com/2007/11/capturing-shell-output-in-python.html
Erik
A: 
import subprocess
p1 = subprocess.Popen('ant compile', stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
print p1.stdout.read(-1)
print p1.stdin.read(-1)
print p1.stderr.read(-1)

Try using subprocess to get the output/error.....

Tumbleweed
really thanks !