I am trying to run a python program from my ant build.xml file when running the build.xml file i am unable to pass arguments to python script
Python program to check factorial of a given number:
fact.py
#!/usr/bin/python
def factorial(num):
if num == 1:
return num
else:
return num * factorial(num - 1)
num = int(input('Enter a Number: '))
if num < 0:
print 'Factorial cannot be found for negative numbers'
elif num == 0:
print 'Factorial of 0 is 1'
else:
print ('Factorial of', num, 'is: ', factorial(num))
The build.xml file looks like as below:
<project name="ant_test" default="python" basedir=".">
<target name="python" >
<exec dir="D:\app\python" executable="D:\app\python\python.exe" failonerror="true">
<arg line="D:\app\ant-workout\fact.py/>
</exec>
</target>
when running the build.xml file it runs the fact.py python program and it was expecting a user input to check the factorial of a given number .
How can i pass the number to the python program from ant build.xml file
Thanks in Advance!!!!!