ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
657 stars 32 forks source link

'NoneType' object has no attribute 'id' #64

Closed Swallowtail23 closed 1 year ago

Swallowtail23 commented 1 year ago

Description

Error message per below

What I Did

Started the container...

2022-12-10 00:17:06 [   INFO    ] unifi_protect_backup.missing_event_checker :  Starting Missing Event Checker
2022-12-10 00:17:11 [  WARNING  ] unifi_protect_backup.missing_event_checker :  Unexpected exception occurred during missing event check:
2022-12-10 00:17:11 [   ERROR   ] unifi_protect_backup.missing_event_checker :  'NoneType' object has no attribute 'id'
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/unifi_protect_backup/missing_event_checker.py", line 65, in start
    downloading_event_ids.add(self._downloader.current_event.id)
AttributeError: 'NoneType' object has no attribute 'id'
jtscott commented 1 year ago

I just updated as well after quite some time. Here is my error

2022-12-09 17:31:59 [ DEBUG ] unifi_protect_backup.downloader : ffprobe found: /usr/bin/ffprobe 2022-12-09 17:31:59 [ INFO ] unifi_protect_backup.unifi_protect_backup : Starting... 2022-12-09 17:31:59 [ INFO ] unifi_protect_backup.downloader : Starting Downloader 2022-12-09 17:31:59 [ INFO ] unifi_protect_backup.uploader : Starting Uploader 2022-12-09 17:31:59 [ DEBUG ] unifi_protect_backup.event_listener : Subscribed to websocket 2022-12-09 17:31:59 [ INFO ] unifi_protect_backup.missing_event_checker : Starting Missing Event Checker 2022-12-09 17:32:01 [ WARNING ] unifi_protect_backup.missing_event_checker : Unexpected exception occurred during missing event check: 2022-12-09 17:32:01 [ ERROR ] unifi_protect_backup.missing_event_checker : 'NoneType' object has no attribute 'id' Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/unifi_protect_backup/missing_event_checker.py", line 65, in start downloading_event_ids.add(self._downloader.current_event.id) AttributeError: 'NoneType' object has no attribute 'id' ([\d.]+)(B|KiB|MiB|GiB|TiB|PiB|EiB|ZiB|YiB) [custom-init] No custom services found, skipping... [migrations] started [migrations] no migrations found usermod: no changes

ep1cman commented 1 year ago

Sorry, I rushed a release last night when I had a spare moment and didn't test properly.

A fix has just been pushed and being released.

Fun story: since the CI for this repo is setup to

I was able to fix this from my phone on a train travelling through Cambridgeshire countryside at 6am 😃 We live in the future!

Once again sorry for the issues!

jtscott commented 1 year ago

Thank you ❤️

Swallowtail23 commented 1 year ago

On 0.8.6, a different error.

2022-12-10T23:52:37.646168970+10:00 stderr F 2022-12-10 13:52:37 [   ERROR   ] unifi_protect_backup.missing_event_checker :  'tuple' object has no attribute 'id'
2022-12-10T23:52:37.646168970+10:00 stderr F Traceback (most recent call last):
2022-12-10T23:52:37.646168970+10:00 stderr F   File "/usr/lib/python3.10/site-packages/unifi_protect_backup/missing_event_checker.py", line 69, in start
2022-12-10T23:52:37.646168970+10:00 stderr F     uploading_event_ids = {event.id for event in self._uploader.upload_queue._queue}
2022-12-10T23:52:37.646168970+10:00 stderr F   File "/usr/lib/python3.10/site-packages/unifi_protect_backup/missing_event_checker.py", line 69, in <setcomp>
2022-12-10T23:52:37.646168970+10:00 stderr F     uploading_event_ids = {event.id for event in self._uploader.upload_queue._queue}
2022-12-10T23:52:37.646168970+10:00 stderr F AttributeError: 'tuple' object has no attribute 'id'
2022-12-10T23:52:41.145633913+10:00 stderr F 2022-12-10 13:52:41 [   INFO    ] unifi_protect_backup.uploader              : [63948ed003a1bf03e40efc88]  Uploading event: 63948ed003a1bf03e40efc88
2022-12-10T23:52:56.383474684+10:00 stderr F 2022-12-10 13:52:56 [   INFO    ] 
ep1cman commented 1 year ago

Sorry been a busy few days for me I will address this tonight and test it properly


From: Swallowtail23 @.> Sent: Saturday, December 10, 2022 8:24:51 PM To: ep1cman/unifi-protect-backup @.> Cc: Sebastian Goscik @.>; Comment @.> Subject: Re: [ep1cman/unifi-protect-backup] 'NoneType' object has no attribute 'id' (Issue #64)

On 0.8.6, a different error.

2022-12-10T23:52:37.646168970+10:00 stderr F 2022-12-10 13:52:37 [ ERROR ] unifi_protect_backup.missing_event_checker : 'tuple' object has no attribute 'id' 2022-12-10T23:52:37.646168970+10:00 stderr F Traceback (most recent call last): 2022-12-10T23:52:37.646168970+10:00 stderr F File "/usr/lib/python3.10/site-packages/unifi_protect_backup/missing_event_checker.py", line 69, in start 2022-12-10T23:52:37.646168970+10:00 stderr F uploading_event_ids = {event.id for event in self._uploader.upload_queue._queue} 2022-12-10T23:52:37.646168970+10:00 stderr F File "/usr/lib/python3.10/site-packages/unifi_protect_backup/missing_event_checker.py", line 69, in 2022-12-10T23:52:37.646168970+10:00 stderr F uploading_event_ids = {event.id for event in self._uploader.upload_queue._queue} 2022-12-10T23:52:37.646168970+10:00 stderr F AttributeError: 'tuple' object has no attribute 'id' 2022-12-10T23:52:41.145633913+10:00 stderr F 2022-12-10 13:52:41 [ INFO ] unifi_protect_backup.uploader : [63948ed003a1bf03e40efc88] Uploading event: 63948ed003a1bf03e40efc88 2022-12-10T23:52:56.383474684+10:00 stderr F 2022-12-10 13:52:56 [ INFO ]

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fep1cman%2Funifi-protect-backup%2Fissues%2F64%23issuecomment-1345377732&data=05%7C01%7C%7Ca9e8375033fa4941ccd208dadaec9810%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638063006938817185%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AdkhBCtkMQJG2Mcd6ChlW4VyuzEkoPm72I%2Bg3HC05%2Bk%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABIOY4N4KABQB4UVVJY3LJ3WMTRJHANCNFSM6AAAAAASZ4FWZM&data=05%7C01%7C%7Ca9e8375033fa4941ccd208dadaec9810%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638063006938817185%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0l%2FgsndieY%2B3qfodXX1SVZFLXnHTBQO2izxjgJVmp9s%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

Swallowtail23 commented 1 year ago

All good... thank you. I've updated to 0.8.7, will see how it runs.

Two suggestions:

  1. As the container boots log the version, i.e. this line:

    2022-12-12T11:37:41.962213664+10:00 stderr F 2022-12-12 01:37:41 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Starting...

    Could be:

    2022-12-12T11:37:41.962213664+10:00 stderr F 2022-12-12 01:37:41 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Starting v0.8.7...
  2. I have podman (docker) set to use my local timezone, and the logging shows that is working (note above line starts with 2022-12-12T11:37:41.962213664+10:00, i.e. UTC+10), but UPB's logging uses only UTC:

    2022-12-12 01:37:41 [   INFO    ] unifi_protect_backup.unifi_protect_backup  :  Starting...

    Can UPB use the container's TZ instead of UTC?

ep1cman commented 1 year ago

Could you open a new issue to track the timezone bug. I'll add the version string on whatever ends up being the next release.

I'll close this issue now as it sends to be working now