On 03/03/2011 18:14, Thom Hehl wrote:
I am attempting to write a python script that will check out and build
our code, then deploy the executable. It will report any failures via
e-mail.

To this end, I’m trying to run my ant build from inside of python. I
have tried the following:

proc = subprocess.Popen(ant -version')

proc = subprocess.Popen(call ant -version')

These both generate:

Traceback (most recent call last):

File "C:\Users\thom\Documents\workspace\autobuild\build.py", line 19, in
<module>

proc = subprocess.Popen('call ant -version')

File "C:\Python32\lib\subprocess.py", line 736, in __init__

restore_signals, start_new_session)

File "C:\Python32\lib\subprocess.py", line 946, in _execute_child

startupinfo)

WindowsError: [Error 2] The system cannot find the file specified

If I run python from the command prompt and generate this error, I turn
around immediately and run ant –version and it works fine, so it’s not a
path issue.

Please help?

Try passing the command line arguments as a list of strings:

    proc = subprocess.Popen(['call', 'ant', '-version'])

You might need to provide the full path of 'ant'.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to