Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I remove tags from an existing snapshot using the python api? #38

Open
ahcheing opened this issue May 22, 2024 · 0 comments
Open

Comments

@ahcheing
Copy link


Describe the bug

A clear and concise description of what the bug is.

I cant use the python api. I am trying to keep tags for wallabag and archivebox in sync (see https://zulip.archivebox.io/#narrow/stream/154-support/topic/Managing.20Tags.20in.20CLI for more details) and therefore need to be able to remove tags using a script.

I know that if I need to run an archivebox cli command I need to do for example:

cd /home/yunohost.app/archivebox/
sudo -u archivebox /var/www/archivebox/venv/bin/archivebox add "$1" --tag "$2"

But when I try to run commands on python api for example, I get a bunch of weird errors:

root@yunohost:~# cd /home/yunohost.app/archivebox/
root@yunohost:/home/yunohost.app/archivebox# sudo -u archivebox /var/www/archivebox/venv/bin/python3 -c "from archivebox.main import setup_django, Tag, Snapshot; setup_django(); Snapshot.objects.get(url='https://example.com').tag_set.remove(Tag.objects.get(name='tag1'))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/var/www/archivebox/venv/lib/python3.9/site-packages/archivebox/main.py", line 14, in <module>
    from .cli import (
  File "/var/www/archivebox/venv/lib/python3.9/site-packages/archivebox/cli/__init__.py", line 83, in <module>
    SUBCOMMANDS = list_subcommands()
  File "/var/www/archivebox/venv/lib/python3.9/site-packages/archivebox/cli/__init__.py", line 43, in list_subcommands
    module = import_module('.archivebox_{}'.format(subcommand), __package__)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/var/www/archivebox/venv/lib/python3.9/site-packages/archivebox/cli/archivebox_version.py", line 11, in <module>
    from ..main import version
ImportError: cannot import name 'version' from partially initialized module 'archivebox.main' (most likely due to a circular import) (/var/www/archivebox/venv/lib/python3.9/site-packages/archivebox/main.py)

Not sure what to do with this. Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant