Execute a python script REMOTELY using another python script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Execute a python script REMOTELY using another python script

I have a python script in my remote computer. I need to execute that script with my local system, using a python script. Please do help me. Please provide me a python script to do so, or atleast imform me about the procedure, libraries, or built-in functions that I can use

31st Jul 2018, 1:29 PM
Priyanka P
Priyanka P - avatar
6 Answers
+ 1
I can make a listen server, but I need a python script to run that listen server. Nomally people write 2 scripts for RPC, one for the server and the other for the client at local and remote system respectively. What I want is a single script at the local system, that can run the client script at the remote system
1st Aug 2018, 10:01 AM
Priyanka P
Priyanka P - avatar
+ 1
Markus Kaleton can u give me example scripts?
2nd Aug 2018, 5:03 AM
Priyanka P
Priyanka P - avatar
0
you could make a listen server to the remote computer that waits for x package and when it receives it, it runs the script function. then just make a script on the local machine that sends this package. needed. Modules: socket and socketserver,
1st Aug 2018, 5:26 AM
Markus Kaleton
Markus Kaleton - avatar
0
depending on the OS and how the network is set up, you could write a python script that runs psexec which commands the target system to run the python file. or if you have ssh you could send execute over that
1st Aug 2018, 11:16 AM
Markus Kaleton
Markus Kaleton - avatar
0
I doubt i have any examples saved up and I'm busy this week to write you one, but you should check os module and check microsoft site for psexec. I've ran psexec scripts with powershell but they can be done with python as well. Everything is also highly dependant on your target system
2nd Aug 2018, 5:38 AM
Markus Kaleton
Markus Kaleton - avatar
0
or ssh, etc module possibilities
2nd Aug 2018, 5:39 AM
Markus Kaleton
Markus Kaleton - avatar