subprocess running ant

Thom Hehl Thom at pointsix.com
Thu Mar 3 13:27:34 EST 2011


Actually, I just figured out the issue is that I need to run ant.bat
instead of just ant. :(

This isn't going to work because I wanted to run something that would be
system independent. So I found the runant.py and I'm trying to figure
out how to call it.

I tried import runant but it can't find the file. I tried reading the
documentation, but it doesn't say how it builds the search path for
imported items.

Can someone tell me how I can run this script?

Thanks.

-----Original Message-----
From: python-list-bounces+thom=pointsix.com at python.org
[mailto:python-list-bounces+thom=pointsix.com at python.org] On Behalf Of
MRAB
Sent: Thursday, March 03, 2011 1:25 PM
To: python-list at python.org
Subject: Re: subprocess running ant

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




More information about the Python-list mailing list