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:
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
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
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
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):
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,'\