Skip to content

[BUG] Latest version fails to import books to calibre #90

@holl595

Description

@holl595

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I have had to go back to version-9559abb2 which has resolved the issue, I'm not sure what has been broken in the latest version but when trying to import a book into the calibre library it fails with the following in the logs.

/app/lazylibrarian/lazylibrarian/calibre_integration.py", line 475, in send_to_calibre f"Unhandled exception importing to calibre: {traceback.format_exc()}" ^^^^^^^^^ NameError: name 'traceback' is not defined. Did you forget to import 'traceback'

Expected Behavior

The book should import as it does with version-9559abb2

Steps To Reproduce

Download a book and then run the post processor

Environment

- OS: Debian 12
- How docker service was installed: disto package manager

CPU architecture

x86-64

Docker creation

Docker compose

Container logs

2025-12-31 19:44:23,812 DEBUG: Found folder (100.0%) [/downloads/sabnzbd/complete/Katherine Rundell - The Good Thieves (retail) (epub)] for ebook Katherine Rundell - The Good Thieves (retail) (epub) [postprocess.py:1642 (POSTPROCESS)]
2025-12-31 19:44:23,813 DEBUG: Found match (100.0%): /downloads/sabnzbd/complete/Katherine Rundell - The Good Thieves (retail) (epub) for BookState(id=43822081, type=eBook, download_title='Katherine Rundell - The Good T...', source=SABNZBD, status=Snatched, candidate=/downloads/sabnzbd/complete/Katherine Rundell - The Good Thieves (retail) (epub), skipped=False) Katherine Rundell - The Good Thieves (retail) (epub) [postprocess.py:1797 (POSTPROCESS)]
2025-12-31 19:44:23,817 INFO: DESTINATION PROCESSING - Book type: ebook, Source: /downloads/sabnzbd/complete/Katherine Rundell - The Good Thieves (retail) (epub), Destination: /books/Katherine Rundell/The Good Thieves, Global name: The Good Thieves - Katherine Rundell [postprocess.py:3682 (POSTPROCESS)]
2025-12-31 19:44:23,817 DEBUG: PreProcess (ebook) /downloads/sabnzbd/complete/Katherine Rundell - The Good Thieves (retail) (epub) [postprocess.py:3737 (POSTPROCESS)]
2025-12-31 19:44:23,885 ERROR: Unhandled exception in process_dir: Traceback (most recent call last):
  File "/app/lazylibrarian/lazylibrarian/calibre_integration.py", line 94, in send_to_calibre
    dstfile = os.path.join(folder, global_name.replace('"', "_") + extn)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/lazylibrarian/lazylibrarian/postprocess.py", line 2874, in process_dir
    result = _process_snatched_book(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lazylibrarian/lazylibrarian/postprocess.py", line 2188, in _process_snatched_book
    return _process_book_after_matching(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lazylibrarian/lazylibrarian/postprocess.py", line 2109, in _process_book_after_matching
    success, dest_file, book_path = _process_destination(
                                    ^^^^^^^^^^^^^^^^^^^^^
  File "/app/lazylibrarian/lazylibrarian/postprocess.py", line 3792, in _process_destination
    return send_to_calibre(book_type, global_name, book_path, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lazylibrarian/lazylibrarian/calibre_integration.py", line 475, in send_to_calibre
    f"Unhandled exception importing to calibre: {traceback.format_exc()}"
                                                 ^^^^^^^^^
NameError: name 'traceback' is not defined. Did you forget to import 'traceback'
 [postprocess.py:2936 (POSTPROCESS)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions