[Tutor] Passing arguments to & running a python script on a remote machine from a python script on local machine .
d at davea.name
Wed Sep 19 21:57:55 CEST 2012
On 09/19/2012 03:45 PM, ashish makani wrote:
> Thanks a ton for the prompt reply & the great suggestions, Dave.
Please don't top post. In this mailing list, the convention is to put
your remarks after the part you're quoting (which usually isn't the
entire message). That way, if the context gets complex, it's easier to
see who wrote what, and in what order.
> 1. A colleague gave this exact same suggestion
> os.system ('ssh remoteuser at remote python remote.py arg1 "arg 2 has spaces"
> I was thinking spaces is my problem, so i initially tested the following
> (no ssh)
> os.system('python remote.py arg1 "arg 2 has spaces" arg3') & it works :)
> But sadly, os.system ('ssh remoteuser at remote python remote.py arg1 "arg 2
> has spaces" arg3') does not :(
Did you try it the way I suggested above? Make it work in ssh, then
worry about how python can build that command string.
> 2. Also, you mentioned os.exec
> Which would you recommend ?
> os.system or os.exec ?
Since there's no os.exec, it was just an brain-hiccup on my part.
So, back to the problem. Once you've got it working in ssh, then we can
figure how to make os.exec, or other python execution mechanism, work.
More information about the Tutor