1

As the picamera has a lot of flexilibity, I have integrated it using boost::python to my C++ program.

In my application I create a PiCamera() instance at the beginning in order to continuously update the awb algorithm. The main problem occurs if the application closes unexpectedly, when I try to run it again I have the following error:

./externalC++App

mmal: mmal_vc_component_enable: failed to enable compononent : ENOSPC
Traceback (most recent call last):
File "", line, in
...
...
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled: Out of resources (other than memory)

I know that is due to a unreleased camera object in the previous execution (but I couldn't manage it because I got a segmentation error).

Of course, the best solution will be fix all that unexpected endings, but we are in a really early stage so that may occur sometimes (we are working to decrease the amount of such errors).

The main question is, there is a way to check if the camera is busy at the beginning and release it if needed? whether in Python or in command shell, both solutions will work for me.

1
  • After the crash, do you get anything useful out of lsof /dev/video0 (or whatever your camera device is called)? Commented Feb 28, 2017 at 12:27

1 Answer 1

0

After Waveform80 made me notice in that GitHub issue that was a problem related with the Boost.Python I tried to find a workaround.

Finally I came up with the following: I forced a Py_Finalize() call at the beginning of my code before a Py_Initialize(), by that way, if the interpreter wasn't properly closed, I do force the closing, and thus release the picamera object, before initializing a new one. Otherwise the Py_Finalize() doesn't take effect.

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.