N
N
nickname19902016-07-09 13:45:02
linux
nickname1990, 2016-07-09 13:45:02

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');
}


?>

Python script:
#!/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

1 answer(s)
A
Armenian Radio, 2016-07-09
@gbg

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 question

Ask a Question

731 491 924 answers to any question