Answer the question
In order to leave comments, you need to log in
Why doesn't exec work correctly?
There is a small python program that captures an image from a webcam (built-in) and saves it to a specific folder. If I call it from the console it works as it should.
But I try to call it from the php script exec, and the whole program does not work correctly. The images that are saved in the folder are corrupted.
php script:
<?php
if(isset($_POST['go']))
{
exec('/var/www/html/web.py');
}
?>
#!/usr/bin/env python
import cv
capture = cv.CaptureFromCAM(-1)
frame = cv.QueryFrame(capture)
cv.SaveImage("/var/www/html/capture.png",frame)
Answer the question
In order to leave comments, you need to log in
There is no pohape of your rights to touch the camera, so the pictures have deteriorated. You need, for example, to configure sudo to execute your specific python script, and then pull it with an exec through this sudo.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question