Are you not missing a keyword?
out = subprocess.getoutput("ps ax | tshark | grep -v grep").split("\n") ... should be: out = subprocess.getoutput("ps ax | grep tshark | grep -v grep").split("\n")