run python script on remote server

Solutions on MaxInterview for run python script on remote server by the best coders in the world

showing results for - "run python script on remote server"
Kaleigh
17 Jan 2017
1As others have said, pipe it into ssh. But what you will want to do is give the proper arguments. You will want to add -u to get the output back from ssh properly. And want to add - to handle the output and later arguments.
2
3ssh user@host python -u - < script.py
4If you want to give command line arguments, add them after the -.
5
6ssh user@host python -u - --opt arg1 arg2 < script.py