How to use Python modules over Paramiko (SSH)?


You connect and use a python module on the remote computer over SSH, as SSH only provides limited functionality so calling the module isn't possible.

You can call a script on the remote server and run that as a way of getting around this problem. To get a result from the script, you can look at it by reading the lines from stdout if you're logging your result. Alternatively, you can write the result to a file and then read the file once the result has been generated and written to the file.

If you want to do this over the network only, then you can have a look at Pyro(https://pypi.python.org/pypi/Pyro4). Pyro means PYthon Remote Objects. It is a library that enables you to build applications in which objects can talk to each other over the network, with minimal programming effort. You can just use normal Python method calls, with almost every possible parameter and return value type, and Pyro takes care of locating the right object on the right computer to execute the method.

Updated on: 30-Jul-2019

380 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements