i'm trying to grab openvpn pid then check to see if its running but this code doesnt seem to work. it tells me 'pid' isn't an integer when the output is '432'
proc = subprocess.Popen(["pgrep openvpn"], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
out = out.strip()
pid = out
print "a process with pid %d exists" % pid
print "a process with pid %d does not exist" % pid
'432' is not an integer; it's a string that holds digits. Convert it to an integer using