-2

So far, SSH is all I can think of. Send a command line like python <dosometing., and interpret the response. I am, however, hoping for a lower level library, where I can enter the Python command in my interpreter's REPL, and have that command execute on the Pi, and return the result to my REPL.

Please no questions why don't I just SSH straight into the Pi and use its Python directly. I don't want to use an SSH session to write Python on my headless Pi. I want a Windows Python REPL that talks to the Raspbian Python transpiler. This is for an experimental task that is part of a much larger project about .NET and Pi communication.

ProfK
  • 49,207
  • 121
  • 399
  • 775
  • To get useful advise you should add more details about what you are trying to archive. – Klaus D. Oct 20 '16 at 04:54
  • @KlausD, please see my edit. – ProfK Oct 20 '16 at 06:35
  • 2
    I'd say you're looking for a higher-level approach than SSH, something that abstracts the user from where the code runs. See http://stackoverflow.com/questions/20499074/run-local-python-script-on-remote-server for some possible approaches, maybe, using SSH under the hood to deliver code to the place it will execute. – DisappointedByUnaccountableMod Oct 20 '16 at 09:52
  • Indeed, Paramiko looks very close to what I'm looking for. I've even marked this as a duplicate, so it has at least one literate's vote to close. – ProfK Oct 20 '16 at 18:16

1 Answers1

1

First thing that comes to my mind is to create a TCP server-client app. Server would reside on RPi, and waiting on connections. When the command arrives from client, server will execute it (using subprocess.Popen or even maybe os.system). Client can get whole output back (in the first case), or just exit status (in the second case).

Fejs
  • 2,734
  • 3
  • 21
  • 40
  • Yes, that seems ideal, but I was hoping for a means to avoid rolling my own TCP based app. – ProfK Oct 20 '16 at 06:32