I have a python script (gcin.py) which gives me the status of a remote, 0 = down 1 = up.
/usr/local/bin/gcin.py -l 2010
0
I'm trying to run this script inside another python script (GetCut.py) using subprocess but can't get it to recognize the sys.argv[1] variable.
import subprocess,sys
lId=int(sys.argv[1])
p = subprocess.Popen("python /usr/local/bin/gcin.py","-l", lId, stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
if output == 1:
print "In"
else:
print "Out"
python GetCut.py 2010
Gives me this error:
Traceback (most recent call last):
File "GetCut.py", line 4, in <module>
p = subprocess.Popen("python /usr/local/bin/gcin.py","-l", lId, stdout=subprocess.PIPE, shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 660, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer
I'd appreciate any help.