I can run my python script locally from console terminal, but when I try to run it from another pc I get Internal Server Error-500,

Error from server

This is the script

this is the content of my script

I tried to use os, commands and subprocess and it doesn´t work. I also made the configurations of the CGI to work with python. I also add this line to the sudoers file:

www-data ALL = NOPASSWD: /path-to-script/xyz.py

I also changed permissions to make it executable. Nothing Worked. Please Help

  • 1
    You should have a look in the server log to get details about the error.
    – goldilocks
    Commented Nov 28, 2017 at 20:37

1 Answer 1


You are running everything with root privileges (sudo). The web server you are using will not and should not have root permissions.

Do you actually need to use sudo with any of those commands?

Python, motion, and cp should not need to be run with sudo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.