Skip to content

Bugfix: can't use Python API #473

@digi-ark

Description

@digi-ark

Describe the bug

Importing the python API fails: ImportError: cannot import name 'update' from partially initialized module 'archivebox.main' (most likely due to a circular import)

Steps to reproduce

  1. pip install archivebox
  2. python -c "from archivebox.main import add"

Screenshots or log output

Python 3.8.5 (default, Aug 12 2020, 00:00:00) 
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from archivebox.main import add, remove, info, config
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/projects/news/ArchiveBox/archivebox/main.py", line 10, in <module>
    from .cli import (
  File "/home/user/projects/news/ArchiveBox/archivebox/cli/__init__.py", line 65, in <module>
    SUBCOMMANDS = list_subcommands()
  File "/home/user/projects/news/ArchiveBox/archivebox/cli/__init__.py", line 41, in list_subcommands
    module = import_module('.archivebox_{}'.format(subcommand), __package__)
  File "/home/user/.virtualenvs/archivebox/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/user/projects/news/ArchiveBox/archivebox/cli/archivebox_update.py", line 11, in <module>
    from ..main import update
ImportError: cannot import name 'update' from partially initialized module 'archivebox.main' (most likely due to a circular import) (/home/user/projects/news/ArchiveBox/archivebox/main.py)

Software versions

  • OS: fedora-32
  • ArchiveBox version: v0.4.21 (from pip: c1f2188 I suppose)
  • Python version: 3.8.5
  • Chrome version: (not relevant)

Additional Notes

Seems to be similar to #372

Metadata

Metadata

Assignees

No one assigned

    Labels

    size: easystatus: doneWork is completed and released (or scheduled to be released in the next version)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions