Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Script crashes when a book has no shelf assigned #8

@Geronimoes

Description

@Geronimoes

First off, thanks a lot for working on this - it fills a need I had for my setup, and works well in most cases!

The issue I encountered: when a book is not assigned to a shelf (other books are assigned to shelves on my setup, this was a test), the script will run into an error when downloading to the local client. Here is the error text:

__main__.py:27Traceback (most recent call last):
  File "/home/username/.local/bin/obsidian_to_bookstack", line 8, in <module>
    sys.exit(main())
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/obsidian_to_bookstack/__main__.py", line 119, in main
    cli()
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/obsidian_to_bookstack/__main__.py", line 59, in local
    b.sync_local()
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/obsidian_to_bookstack/bookstack/bookstack.py", line 291, in sync_local
    self.book_collector.create_local_missing_books()
  File "/home/username/.local/pipx/venvs/obsidian-to-bookstack/lib/python3.10/site-packages/obsidian_to_bookstack/bookstack/collectors/local/BookCollector.py", line 71, in create_local_missing_books
    path = os.path.join(self.path, book.shelf.name, book.name)
AttributeError: 'NoneType' object has no attribute 'name'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions