I have a python script on a remote computer that I want to execute from my local machine. It takes several arguments, and I would run it if I ran it on this machine.
python python_parallel.py --num=10 --ssh=/home/user1/path/file.txt
I currently have python code on my local machine that runs the above script:
from optparse import OptionParser parser.add_option("-n", "--num", type="int", dest="num_spice",help="Enter the number") parser.add_option("-s", "--ssh", dest="ssh_txt",help="Enter the path to the text file") num_spice=options.num_spice ssh_txt=options.ssh_txt (options, args) = parser.parse_args() os.system('ssh user1@10.100.10.201 python /home/user1/path/python_parallel.py --num=%s --ssh=%s' %(num_spice, ssh_txt) )
Is there a better way to do this? I tried the solution on this link , but it gave me the error "ImportError: No module ssh"
source share