I have shell script, which ouput some text result on terminal on execution.
I was able to execute that shellscipt from python script, but I could not store shell script result into python
My python script:
import subprocess
#result = subprocess.call(['/root/Desktop/karim/software/cherrypicker1.01/cherryP.sh'],shell = True) This yields result 0
subprocess.call(['/root/Desktop/karim/software/cherrypicker1.01/cherryP.sh'],shell = True)
print "REsult is : "
print result
cherryP.sh
./cherrypicker.sh input.txt
#for line in $(cat input.txt.responses); do echo "$line" ; done
DONE=false
until $DONE
do
read line || DONE=true
echo $line # this will echo the result which I want to use in python script
done < input.txt.responses
What wrong I am doing, or what is other plausible solution?
UPDATED cherryP.py
import subprocess
result = subprocess.check_output(['/root/Desktop/karim/software/cherrypicker1.01/cherryP.sh'], shell = True)
print result
tail -n 1 input.txt.responses