Skip to content

[QUESTION] I moved to a new Mac; now DeDRM fails to work when re-importing DRMed ePubs to Kobo Aura 2 #2448

@GwynethLlewelyn

Description

@GwynethLlewelyn

CheckList

  • The Title and The Log Title are setted correctly.
  • Clarified about my environment.
  • Code block is used for the log.

I moved to a new Mac; now DeDRM fails to work when re-importing DRMed ePubs to Kobo Aura 2

A good friend of mine took pity on me for using an ancient MacBook Pro from 2014 (!) — the main issue with it was just Apple's forced premature obsolescence; it couldn't run anything more recent than macOS Big Sur, and that meant that less and less applications would run (including Calibre itself) — and got me his 'old', unused MacBook Pro from 2021, which at least has an M1 Apple Silicon CPU and runs macOS Tahoe flawlessly.

Because Apple is retiring support for Intel CPUs in 2028, removing Rosetta 2 entirely, anything which isn't compiled as a Universal Binary will never work again. Although Universal Binaries were introduced in 2020, it's surprising how so many applications provide only an Intel variant — relying on Rosetta 2 for now. They'll have a big surprise in two years...

This meant changing/upgrading/installing a lot of old and broken software for shiny new versions that run on Tahoe with Apple Silicon. I've deliberately not installed Rosetta 2: I wish to be well-prepared for 2028 and have no further surprises!

One of the many applications that had to go was Kobo Desktop. The last version they still have enabled for download is Intel-only; now they only offer the web-based solution.

Now, I understand that DeDRM's Kobo plugin only works if Kobo Desktop is installed. I presume that it will get the keys for unencryption from it; at least, that's what would make sense for me. Although I have long ago de-DRMed most books I bought via Kobo and their partners, today I found one (Isaac Asimov's The Naked Sun; I have proof of purchase if needed 😉) which I forgot to de-DRM back then. So I attempted to do it today.

It seemed that the former Calibre setup I had, which was migrated with Apple's Migration Assistant, lacked a few upgrades/updates; for instance, I had the "otok" plugin, but apparently not the main DeDRM Tools. But the version I got was quite outdated, so I decided to reinstall DeDRM tools from scratch and add the Otok 'companion plugin' as instructed.

Well, unfortunately, there seems to be something I'm missing, since this clearly doesn't work (see the logs). However, the messages there seem to complain only about the XML structure, which is weird, since I was only expecting an error related to the missing Kobo Desktop's decryption keys.

But perhaps these errors are related to just that — because there (apparently) aren't any decryption keys available, everything is just a pile of garbage, thus rendering it impossible to parse.

And since I can't use Kobo Desktop (I can install it — just download it and place it under /Applications — but I can't launch the application), I guess I'm out of luck then? 👀

My Environment

Calibre: 8.16.2

Kindle: N/A

Kobo: Kobo Aura Edition 2 running 4.38.23555

DeDRM: 7.2.1

Calibre is running as an Apple Silicon application (no Rosetta 2) under a MacBook Pro 16" 2021 with macOS Tahoe 26.2 (25C56).

Log

Log when uploading Kobo-DRMed ePub
calibre, version 8.16.2
ERROR: Error: Error communicating with device

Could not kepubify the book The Naked Sun (3712c3a4-301e-4d2d-a331-49ed23632857.epub) failed with error: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

Traceback (most recent call last):
  File "calibre/devices/kobo/driver.py", line 2362, in _kepubify
  File "calibre/ebooks/oeb/polish/kepubify.py", line 546, in kepubify_path
  File "calibre/ebooks/oeb/polish/kepubify.py", line 541, in kepubify_container
  File "calibre/ebooks/oeb/polish/kepubify.py", line 496, in do_work_in_parallel
  File "concurrent/futures/_base.py", line 449, in result
  File "concurrent/futures/_base.py", line 401, in __get_result
  File "concurrent/futures/thread.py", line 58, in run
  File "calibre/ebooks/oeb/polish/kepubify.py", line 476, in process_path
  File "calibre/ebooks/oeb/polish/kepubify.py", line 377, in kepubify_html_path
  File "calibre/ebooks/oeb/polish/kepubify.py", line 370, in kepubify_html_data
  File "calibre/ebooks/oeb/polish/kepubify.py", line 365, in kepubify_parsed_html
  File "calibre/ebooks/oeb/polish/kepubify.py", line 287, in add_kobo_markup_to_html
  File "calibre/ebooks/oeb/polish/kepubify.py", line 256, in add_kobo_spans
  File "calibre/ebooks/oeb/polish/kepubify.py", line 216, in wrap_text_in_spans
  File "src/lxml/etree.pyx", line 1163, in lxml.etree._Element.text.__set__
  File "src/lxml/apihelpers.pxi", line 749, in lxml.etree._setNodeText
  File "src/lxml/apihelpers.pxi", line 737, in lxml.etree._createTextNode
  File "src/lxml/apihelpers.pxi", line 1538, in lxml.etree._utf8
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "calibre/gui2/device.py", line 110, in run
  File "calibre/gui2/device.py", line 661, in _upload_books
  File "calibre/devices/kobo/driver.py", line 2304, in upload_books
  File "calibre/devices/kobo/driver.py", line 2366, in _kepubify
ValueError: Could not kepubify the book The Naked Sun (3712c3a4-301e-4d2d-a331-49ed23632857.epub) failed with error: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

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