I have an existing python script with command params that outputs a string like below . I am trying to call this into another python script and pass the prodName dynamically through another variable.
I tried something like this which works:
#!/usr/bin/env python
import subprocess
subprocess.call("/usr/st/getProdID.py ProdName=someProd_name Prod_config=/usr/st/prod/prod_id.txt", shell=True)
output:
Ad897
I could not redirect this output to a variable
#!/usr/bin/env python
import subprocess
pid = subprocess.call("/usr/st/getProdID.py ProdName=someProd_name Prod_config=/usr/st/prod/prod_id.txt", shell=True)
print "pid = ", pid
output:
Ad897
Pid = 0
Any help is appreciated. Thankyou!