I have a Python file that calls the camera to take video when a motion sensor is triggered.
I am running it at startup using rc.local (I have the '&' at the end).
When I run it normally, it works fine, just not when I run it at boot.
I am getting this error:
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

1 Answer 1


OK, I fixed it. I hope this helps someone... I had used ~/path/to/file.py as the directory to which I wanted to store the footage taken by my Python code. I replaced this with absolute reference: /home/pi/path/to/file.py and that solved it.

  • Given that you have answered your own question you are allowed to accept it as the answer (after a delay which I suspect has now elapsed!) - it is likely that it is the system (possible the root user) that is running the /etc/rc.local - although the new-fangled systemd might change things nowadays - which is NOT the user that would have /home/pi as the home directory which ~ as a initial path component would use (instead it would try to use /root/path/to/file.py).
    – SlySven
    Commented Dec 20, 2018 at 0:56

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.