On Mar 3, 2011 1:19 PM, "Thom Hehl" <t...@pointsix.com> 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? > >
By default, suborocess just spawns a new processes. It does not go through the shell, so you have no path. Try adding shell=true to the Popen call. > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list