Re: [Tutor] run local script on a remote machine

2016-10-28 Thread Steven D'Aprano
If you're trying to do remote command execution, you should forget about rolling your own, and use a well-established RPC solution. I can recommend either of pyro or rpyc: https://pypi.python.org/pypi/Pyro4 https://pypi.python.org/pypi/rpyc If you need a standard library solution, you can try:

Re: [Tutor] run local script on a remote machine

2016-10-27 Thread Alex Kleider
On 2016-10-27 00:22, Cameron Simpson wrote: On 26Oct2016 10:44, Alex Kleider wrote: command = ( "ssh -p22 alex@10.10.10.10 python3 -u - one two three < {}" .format(script)) ret = subprocess.call(shlex.split(command)) This is not fine. .. http://bobby-tables.com/ Thanks for the

Re: [Tutor] run local script on a remote machine

2016-10-27 Thread Alex Kleider
On 2016-10-27 00:57, Wolfgang Maier wrote: The structure of the command you are trying to execute would require you to set the "shell" argument of subprocess.call to True. Specifically, the "<" redirection operator is shell functionality. Thank you Wolfgang. Simply eliminating the call to shl

Re: [Tutor] run local script on a remote machine

2016-10-27 Thread Wolfgang Maier
On 26.10.2016 19:44, Alex Kleider wrote: I've got three files as follows: keeping just the relevant lines ... 2: #!/bin/bash # # file: call.sh # Demonstrates running a local python script on another host # with command line arguments specified locally. ssh -p22 alex@10.10.10.10 python3 -u

Re: [Tutor] run local script on a remote machine

2016-10-27 Thread Cameron Simpson
On 26Oct2016 10:44, Alex Kleider wrote: [... snipped experiment.py and the demo call.sh script ...] 3: #!/usr/bin/env python3 # # file: call.py import os import shlex import subprocess script = "/home/alex/Py/BackUp/Sandbox/Scripted/experiment.py" This is fine. if os.path.isfile(script):

[Tutor] run local script on a remote machine

2016-10-26 Thread Alex Kleider
I've got three files as follows: 1: #!/usr/bin/env python3 # # file: experiment.py # # A simple python program that takes parameters. import sys info = sys.argv[1:] print(info) with open("/home/alex/junk.txt", 'w') as file_object: for item in info: file_object.write(''.join((item,'\