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


Groups > comp.lang.python > #29526

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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <sulfurfff@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'arguments': 0.07; 'python': 0.09; 'arguments,': 0.09; 'machines.': 0.09; 'satisfy': 0.09; 'script,': 0.09; 'solution,': 0.09; 'subject:script': 0.09; 'subject:using': 0.09; 'whitespaces': 0.09; 'worked,': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; 'steve': 0.13; '(the': 0.15; 'folks': 0.15; 'googled': 0.16; 'googling': 0.16; 'ssh': 0.16; 'subject: \n ': 0.16; 'subject:ssh': 0.16; 'string': 0.17; 'sort': 0.21; 'bit': 0.21; 'import': 0.21; 'do.': 0.21; 'lets': 0.22; 'libraries': 0.22; 'machine.': 0.22; 'questions:': 0.22; 'installation': 0.23; 'cc:2**0': 0.23; 'task': 0.23; 'this:': 0.23; 'installed': 0.23; 'cheers': 0.24; 'cc:no real name:2**0': 0.24; 'external': 0.24; 'command': 0.24; 'machine': 0.24; 'pass': 0.25; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'appreciated.': 0.26; 'installing': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'run': 0.28; '>>>>': 0.29; 'concern': 0.29; 'url:mailman': 0.29; 'url:python': 0.32; 'anybody': 0.32; 'running': 0.32; 'url:listinfo': 0.32; 'ubuntu': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'community': 0.35; 'remote': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'subject: (': 0.36; 'execute': 0.37; 'does': 0.37; 'two': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'several': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'easy': 0.60; 'most': 0.61; 'subject:, ': 0.61; 'containing': 0.61; 'situation': 0.62; 'love': 0.63; 'great': 0.64; 'here': 0.65; 'jobs': 0.65; 'subject: & ': 0.67; 'everybody': 0.69; "'local'": 0.84; '2011)': 0.84; 'induce': 0.84; 'researched': 0.84; 'alone.': 0.91; 'don\xe2\x80\x99t': 0.91; 'you\xe2\x80\x99ll': 0.91; '\xe2\x80\x9cthe': 0.91; 'yours.': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=hy42EaxuHXvcaiinBRXMFF4GLFTrPJVOZex6hXjbxH0=; b=YjHe8X01Zl9Enjx8CLlAo6bxYPKyBN+mlbuXQ1UvLy5caSP8MxC9EzexfnDZcL407u cDsUUz/KYjbXk6C01wVrYhPynnE5VpNeyByrweokcAPwbaR/mvfFMqrPKPt48jai3Isv nzFf+VGAs8Fpj42Cmz3mRTDhKGkzTttzVHbz6vtd9I+kKLhXc6o9C7Ws/tmY6w+i/Kmh pI7YSy7r58PUpXyxK69l2Rq06JofzKangzzbVrB/ora6TRHmbYgOXZXaxvDA2WaMUFwZ jKxvPZkhxByDiFcK2DYEftwpXI4bYTSllGXVZVZoPQw3/vDTF0C6i/KPO//xEqIDIqYy npNA==
MIME-Version 1.0
In-Reply-To <10db83e4-80eb-4265-b11c-062269fea1b0@googlegroups.com>
References <10db83e4-80eb-4265-b11c-062269fea1b0@googlegroups.com>
Date Wed, 19 Sep 2012 15:29:15 -0500
Subject Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)
From Ismael Farfán <sulfurfff@gmail.com>
To ashish <ashish.makani@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.940.1348086557.27098.python-list@python.org> (permalink)
Lines 74
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348086557 news.xs4all.nl 6843 [2001:888:2000:d::a6]:44953
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29526

Show key headers only | View raw


2012/9/19 ashish <ashish.makani@gmail.com>:
> Hi c.l.p folks
>
> Here is my situation
>
> 1. I have two machines. Lets call them 'local' & 'remote'.
> Both run ubuntu & both have python installed
>
> 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to a python script, remote.py running on 'remote' (the remote machine).
>
> I have the following questions:
>
> 1. What's the best way to accomplish my task ?
> I have researched quite a bit & pretty much everybody is using ssh.
> After googling a bunch, most people are using very complex workarounds to do this sort of thing.
>
> I googled & found people using several libraries to accomplish ssh to remote machine & execute a command on remote machine.
> paramiko ( now forked into the ssh moduke), fabric, pushy ,etc
>
> People who have used any of these libraries, which one would you recommend, as the most apt (simple & easy to use, lightweight, best performance, etc) for my situation ?
>
> 2. I would prefer a solution, which does NOT require the installation of extra libraries on the local & remote machines.
> If installing external librar
>
> 3. Has anybody been able to do this using os.system ?
>
> I tried this
>>>> import os
>>>> os.system ("ssh remoteuser@remote python remote.py arg1 arg2 arg3")
>
> This worked, but if the arguments i tried to pass, had spaces, i was not able to 'escape' the spaces.

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

Cheers
Ismael


>
> Any & all explanations/links/code snippets/thoughts/ideas/suggestions/feedback/comments/ of the Python tutor community would be greatly appreciated.
>
> Thanks a ton
>
> cheers
> ashish
>
> email :
> ashish.makani
> domain:gmail.com
>
> “The only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it.” - Steve Jobs (1955 - 2011)
> --
> http://mail.python.org/mailman/listinfo/python-list



-- 
Do not let me induce you to satisfy my curiosity, from an expectation,
that I shall gratify yours. What I may judge proper to conceal, does
not concern myself alone.

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