Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29563

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

From Piet van Oostrum <piet@vanoostrum.org>
Newsgroups comp.lang.python
Subject Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)
Date 2012-09-20 19:30 +0200
Message-ID <m2vcf838l2.fsf@cochabamba.vanoostrum.org> (permalink)
References <10db83e4-80eb-4265-b11c-062269fea1b0@googlegroups.com> <mailman.940.1348086557.27098.python-list@python.org>

Show all headers | View raw


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

> How about something like this:
> os.system ( 'ssh remoteuser@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@remote "python remote.py 'arg 1' 'arg 2' 'arg 3'"''')
-- 
Piet van Oostrum <piet@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Passing arguments to & executing, a python script on a remote machine from a python script on local machine  (using ssh ?) ashish <ashish.makani@gmail.com> - 2012-09-19 12:50 -0700
  Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?) Ismael Farfán <sulfurfff@gmail.com> - 2012-09-19 15:29 -0500
    Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?) Piet van Oostrum <piet@vanoostrum.org> - 2012-09-20 19:30 +0200
  Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine  (using ssh ?) Tim Roberts <timr@probo.com> - 2012-09-19 20:51 -0700
  Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine  (using ssh ?) Emile van Sebille <emile@fenx.com> - 2012-09-20 07:50 -0700
  Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?) Chris Rebert <clp2@rebertia.com> - 2012-09-20 09:19 -0700
    Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?) Piet van Oostrum <piet@vanoostrum.org> - 2012-09-20 19:45 +0200

csiph-web