I am trying to use subprocess module for executing remote command. I need to execute program called 'upgrade' that is located on remote server. Also, I need to use an argument in that call. Here is how I tried to do that:
import subprocess
p=subprocess.Popen(['ssh', '15.36.77.1', './home/upgrade -u' ],stdin=subprocess.PIPE,
stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True)
stdout,stderr=p.communicate(input='\n')
When I try to execute this command and get return code form it, I get 255, which means that command failed. Could you help me with this issuse? No third part libraries should be used. Sorry for bad english.