Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

Piet van Oostrum piet at vanoostrum.org
Thu Sep 20 13:30:49 EDT 2012


Ismael Farfán <sulfurfff at gmail.com> writes:

> How about something like this:
> os.system ( 'ssh remoteuser at remote python remote.py "arg 1" "arg 2" "arg 3"' )

That won't work. You need an additional level of quoting because ssh is
also a shell so it adds another level of interpretation.

The following works:

os.system('''ssh remoteuser at remote "python remote.py 'arg 1' 'arg 2' 'arg 3'"''')
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list