How to run a python script that is located on another machine

0

I have 2 raspberry and a windows computer that has an apache server. I want to run a script that is on the server from those 2 raspberry.

I type in the command line:

sudo python3 192.168.0.8//teste/teste.py 

but the following message comes up:

  python3: can not open file '192.168.0.8 /teste/teste.py': [Errno 2] No such file or directory

What am I doing wrong? How to call execute a script that is on a server?

    
asked by anonymous 24.07.2018 / 16:02

2 answers

1

Python does not have remote execution functionality. You need to "mount" the remote folder and provide a local path to python:

mkdir /pasta_local
sudo mount -t cifs //192.168.0.8/compartilhamento/ /pasta_local

Then use this folder to access the server:

python3 /pasta_local/teste/teste.py

Another way is if the script is being provided by apache, you download the script via http, using curl or wget , then just run it.

curl http://192.168.0.8/teste.py -o teste.py
python3 teste.py
    
26.07.2018 / 19:00
-1

Very likely this is a privileges problem, check if the folder in which the files are is allowed to admin, if it does not have such privileges, and after that restart the service and try to start the page, if not solve, verify if all Python libraries and just like all features are installed on the server so you do not find problems.

First you will edit the sudoers file with the following command:

I came / etc / sudoers or gedit / etc / sudoers

and add the following line to this file:

username ALL = (root) NOPASSWD: ALL

So everything you run in apache will be like superuser.

    
24.07.2018 / 16:34