Passing arguments to & executing, a python script on a remote machinefrom a python script on local m

A

ashish

Hi PyTutor 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 & so far found really conflicting & complex workarounds.

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
This worked, but if the arguments i tried to pass, had spaces, i was not able to 'escape' the spaces.

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)
 
S

Steven D'Aprano

Hi PyTutor 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).

If 3/4 of the arguments are strings, what sort of objects are the other
1/4?

I have the following questions:

1. What's the best way to accomplish my task ?

Use a dedicated remote procedure call library. Do not try to invent your
own. The wheel has already been invented, you are just wasting your time.

I've used both Pyro and Rpyc, either of them seem perfectly reasonable.
There are many others, but frankly I don't think there is a "best of
breed" that stands far ahead of the rest.
 
C

Chris Angelico

If 3/4 of the arguments are strings, what sort of objects are the other
1/4?

I understand the OP as meaning "three or four string arguments".

ChrisA
 
A

ashish

Sorry for the confusion Steven.
There are 3 or 4 arguments, all of which are strings.
I understand the OP as meaning "three or four string arguments".

Yup, that's what i meant.
 
A

ashish

Sorry for the confusion Steven.
There are 3 or 4 arguments, all of which are strings.
I understand the OP as meaning "three or four string arguments".

Yup, that's what i meant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top