5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

picameraでエラー発生時の対象方法

Last updated at Posted at 2018-03-23

picameraでエラーが発生した際の備忘録です。

現象

picameraのインスタンス生成時に下記のようなエラーが発生


>>> import picamera
>>> camera = picamera.PiCamera()
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x113f660 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/picamera/camera.py", line 433, in __init__
    self._init_preview()
  File "/usr/local/lib/python3.6/site-packages/picamera/camera.py", line 513, in _init_preview
    self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
  File "/usr/local/lib/python3.6/site-packages/picamera/renderers.py", line 558, in __init__
    self.renderer.inputs[0].connect(source).enable()
  File "/usr/local/lib/python3.6/site-packages/picamera/mmalobj.py", line 2212, in enable
    prefix="Failed to enable connection")
  File "/usr/local/lib/python3.6/site-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

原因

比較のために複数のカメラ用ソフトウェアをインストールしており、他のプロセスがカメラモジュールにアクセスしていたため、リソースの競合が発生していました。
この時はRPi-Cam-Web-Interfaceが起動していたので、下記のコマンドで停止して事象を回避できることを確認しています。


# cd /usr/local/bin/RPi_Cam_Web_Interface
# ./stop.sh
>>> import picamera
>>> camera = picamera.PiCamera()
>>>
5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?