FutureSharks / rpi-security

A security system written in python to run on a Raspberry Pi with motion detection and mobile notifications
GNU General Public License v2.0
215 stars 71 forks source link

Failed to take photo: PiCameraMMALError #42

Closed jnaulty closed 4 years ago

jnaulty commented 5 years ago

Ran into an issue with the /photo command.

Running on a raspberry pi 3+

Not sure if this is related to rpi-security or something in picamera, but posting here first for when I find a proper solution.

pi@raspi-3:~/workspace/rpi-security $ systemctl status rpi-security
● rpi-security.service - rpi-security service
   Loaded: loaded (/lib/systemd/system/rpi-security.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-03-22 21:12:25 GMT; 1min 25s ago
  Process: 6029 ExecStopPost=/sbin/iw dev ${RPI_SEC_MON} del (code=exited, status=0/SUCCESS)
  Process: 5996 ExecStop=/usr/bin/pkill rpi-security.py (code=exited, status=0/SUCCESS)
  Process: 6869 ExecStartPre=/sbin/ip link set ${RPI_SEC_MON} up (code=exited, status=0/SUCCESS)
  Process: 6864 ExecStartPre=/sbin/iw dev ${RPI_SEC_WLAN_ITFC} interface add ${RPI_SEC_MON} type monitor (code=exited, status=0/SUCCESS)
 Main PID: 6877 (rpi-security.py)
   CGroup: /system.slice/rpi-security.service
           └─6877 /usr/bin/python3 /usr/local/bin/rpi-security.py

Mar 22 21:12:30 raspi-3 rpi-security.py[6877]: process_photos.py:process_photos thread running
Mar 22 21:12:30 raspi-3 rpi-security.py[6877]: rpi-security.py:MainThread rpi-security running
Mar 22 21:12:30 raspi-3 rpi-security.py[6877]: telegram_bot.py:telegram_bot thread running
Mar 22 21:12:31 raspi-3 rpi-security.py[6877]: rpis_security.py:MainThread Telegram message Sent: "rpi-security running"
Mar 22 21:13:12 raspi-3 rpi-security.py[6877]: rpis_camera.py:dispatcher Failed to take photo: PiCameraMMALError('Failed to enable component: Out of resources',)
Mar 22 21:13:12 raspi-3 rpi-security.py[6877]: dispatcher.py:dispatcher An uncaught error was raised while processing the update
                                               Traceback (most recent call last):
                                                 File "/usr/local/lib/python3.5/dist-packages/python_telegram_bot-12.0.0b1-py3.5.egg/telegram/ext/dispatcher.py", line 333, in process_update
                                                   handler.handle_update(update, self, check, context)
                                                 File "/usr/local/lib/python3.5/dist-packages/python_telegram_bot-12.0.0b1-py3.5.egg/telegram/ext/handler.py", line 120, in handle_update
                                                   return self.callback(dispatcher.bot, update, **optional_args)
                                                 File "/usr/local/lib/python3.5/dist-packages/rpi_security-1.0-py3.5.egg/rpisec/threads/telegram_bot.py", line 57, in photo
                                                   rpis.telegram_send_file(photo)
                                                 File "/usr/local/lib/python3.5/dist-packages/rpi_security-1.0-py3.5.egg/rpisec/rpis_security.py", line 221, in telegram_send_file
                                                   filename, file_extension = os.path.splitext(file_path)
                                                 File "/usr/lib/python3.5/posixpath.py", line 122, in splitext
                                                   return genericpath._splitext(p, sep, None, extsep)
                                                 File "/usr/lib/python3.5/genericpath.py", line 118, in _splitext
                                                   sepIndex = p.rfind(sep)
                                               AttributeError: 'NoneType' object has no attribute 'rfind'
Mar 22 21:13:27 raspi-3 rpi-security.py[6877]: rpis_security.py:monitor_alarm_state Telegram message Sent: "rpi-security is now armed"
Mar 22 21:13:27 raspi-3 rpi-security.py[6877]: rpis_state.py:monitor_alarm_state rpi-security is now armed
Mar 22 21:13:37 raspi-3 rpi-security.py[6877]: rpis_camera.py:dispatcher Failed to take photo: PiCameraMMALError('Failed to enable component: Out of resources',)
Mar 22 21:13:37 raspi-3 rpi-security.py[6877]: dispatcher.py:dispatcher An uncaught error was raised while processing the update
                                               Traceback (most recent call last):
                                                 File "/usr/local/lib/python3.5/dist-packages/python_telegram_bot-12.0.0b1-py3.5.egg/telegram/ext/dispatcher.py", line 333, in process_update
                                                   handler.handle_update(update, self, check, context)
                                                 File "/usr/local/lib/python3.5/dist-packages/python_telegram_bot-12.0.0b1-py3.5.egg/telegram/ext/handler.py", line 120, in handle_update
                                                   return self.callback(dispatcher.bot, update, **optional_args)
                                                 File "/usr/local/lib/python3.5/dist-packages/rpi_security-1.0-py3.5.egg/rpisec/threads/telegram_bot.py", line 57, in photo
                                                   rpis.telegram_send_file(photo)
                                                 File "/usr/local/lib/python3.5/dist-packages/rpi_security-1.0-py3.5.egg/rpisec/rpis_security.py", line 221, in telegram_send_file
                                                   filename, file_extension = os.path.splitext(file_path)
                                                 File "/usr/lib/python3.5/posixpath.py", line 122, in splitext
                                                   return genericpath._splitext(p, sep, None, extsep)
                                                 File "/usr/lib/python3.5/genericpath.py", line 118, in _splitext
                                                   sepIndex = p.rfind(sep)
                                               AttributeError: 'NoneType' object has no attribute 'rfind'
jnaulty commented 5 years ago

a reboot fixed this. uptime was ~8 days

FutureSharks commented 5 years ago

Hi @jnaulty, do you have any other apps on your Pi that use the camera?

jnaulty commented 5 years ago

No other apps that I'm aware of..

FutureSharks commented 5 years ago

What version are you using? When did you install it? Does it do this all the time? Or just some times?