ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
577 stars 25 forks source link

new to python #66

Closed tikesavage closed 1 year ago

tikesavage commented 1 year ago

Description

issue with getting Python code to run.

What I Did

followed instructions for rclone with g drive. and installed python, pip and ffprobe. now need to run the code.

~/.local/lib/python3.10/site-packages/unifi_protect_backup$ python3 unifi_protect_backup.py

error:

Traceback (most recent call last):
  File "/home/username/.local/lib/python3.10/site-packages/unifi_protect_backup/unifi_protect_backup.py", line 16, in <module>
    from unifi_protect_backup import EventListener, MissingEventChecker, Purge, VideoDownloader, VideoUploader
  File "/home/username/.local/lib/python3.10/site-packages/unifi_protect_backup/unifi_protect_backup.py", line 16, in <module>
    from unifi_protect_backup import EventListener, MissingEventChecker, Purge, VideoDownloader, VideoUploader
ImportError: cannot import name 'EventListener' from partially initialized module 'unifi_protect_backup' (most likely due to a circular import) (/home/username/.local/lib/python3.10/site-packages/unifi_protect_backup/unifi_protect_backup.py)
ep1cman commented 1 year ago

You shouldn't run the python file directly like that. If you have done a pip install you should instead just run the command unifi-protect-backup

tikesavage commented 1 year ago

no luck either, tried that first.
~/.local/lib/python3.10/site-packages/unifi_protect_backup$ unifi-protect-backup unifi-protect-backup: command not found

ep1cman commented 1 year ago

Have you tried logging out and back in?

https://askubuntu.com/a/1384895

tikesavage commented 1 year ago

yes ^^ PIP 'worked' but i reinstalled with pip3 and that resolved it for me.

my follow up is can you provide some sanitized exampled of using calling the module?

visual learner really helps

ep1cman commented 1 year ago

Do you mean the command line tool? The module itself is not intended to be used directly. I would suggest checking out pyunifiprotect if that's what you want.

As for how to use the tool, if you run unifi-protect-backup --help it will explain all the options and which ones are required. It can also be found in the readme.