Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-09-2026, 05:34 PM   #1
GeorgeYellow
Enthusiast
GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!GeorgeYellow is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 50
Karma: 50002
Join Date: Nov 2017
Device: Nook, Kindle
Some unexpected Calibre behavior

Today, I found that an old but stable and working Calibre installation suddenly ceased to fetch metadata.

The error was pervasive, with every metadata source:
Code:
ERROR: Download failed: Failed to download metadata. Click Show Details to see details
... 
  File "<string>", line 15, in <module>
ImportError: cannot import name _
In case I'm not the only person running an ancient Calibre, the solution is:
1. Add the single line `127.0.0.1 code.calibre-ebook.com` to `C:\Windows\System32\drivers\etc`

2. Rename or Delete the file `Calibre Settings\metadata-sources-cache.json'

The reason for this error are with the dynamic code execution that Calibre does when it checks updates. This mechanism does not check a version number so it will run python code intended for new Calibre releases on old versions.

That mechanism is in the Updates plugin at https://github.com/kovidgoyal/calibr...rces/update.py
Note that this plugin is expressly forbidden to be disabled in the Calibre UI!

The code will fetch `https://code.calibre-ebook.com/metadata-sources/hashes.json` (which, despite the file name, is `bzip2` compressed. It can be expanded with `bzcat`. If a hash in this download doesn't match the previous hashes, calibre will fetch the updated python code from `https://code.calibre-ebook.com/metadata-sources/<NAME>` (eg, google, amazon, etc)
Then, it will pass that code directly to `exec()`

I was worried when I first looked at this, because `code.calibre-ebook.com` has a strange certificate - fortunately it is self-signed so that only people with the private key can dynamically run Python code on every Calibre installation.

The initial error was because the new plugins all use the Python "throwaway" syntax in an import:
Code:
from calibre.utils.localization import _
Fortunately I'm not paranoid, and I don't believe that any actor would POSSIBLY compel a software developer to serve specific code to a specific IP range, and anyone who can think of counter examples is a conspiracy theorist.
GeorgeYellow is offline   Reply With Quote
Old 07-09-2026, 08:27 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,936
Karma: 64187770
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
localhost (127.0.0.1) is how Calibre talks to some of its pieces (worker process is a background piece).
This is a very common method.
theducks is offline   Reply With Quote
Advert
Old 07-09-2026, 10:07 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,453
Karma: 29634066
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Not sure what's so unexpected about that? You get the entire calibre program from the same server (group of servers), if someone compromised the developer (me) they could just as well serve you compromised calibre binaries in the first place.

And it uses a self signed certificate deliberately, precisely so no third parties other than me are in the network trust chain.

FYI various network facing bits of calibre are dynamically updated recipes, get books, metadata sources etc etc. and have been for a decade plus.
kovidgoyal is offline   Reply With Quote
Old 08-01-2026, 04:54 PM   #4
richorlin
Enthusiast
richorlin began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Oct 2007
Device: Kindle, iPad
How do you make the correction for Calibre running on a Mac? Thanks
richorlin is offline   Reply With Quote
Old 08-01-2026, 06:52 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 84,637
Karma: 153744859
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by richorlin View Post
How do you make the correction for Calibre running on a Mac? Thanks
What correction is needed?
JSWolf is offline   Reply With Quote
Advert
Old 08-01-2026, 10:35 PM   #6
richorlin
Enthusiast
richorlin began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Oct 2007
Device: Kindle, iPad
Quote:
Originally Posted by JSWolf View Post
What correction is needed?
The solution in the first post.
richorlin is offline   Reply With Quote
Old 08-02-2026, 02:45 AM   #7
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 54,029
Karma: 182150335
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
MacOS uses the same directory name as Windows and Linux and multiple other OS. Look for the etc folder in the private folder (goto folder: /private/etc). Inside that folder, look for the hosts file.

Personally, I can't see how that line was added to etc by the original poster since etc is a directory/folder and not an editable file. You can add that information to the hosts file inside the etc folder (under MacOS, open Terminal and enter sudo nano /etc/hosts which should do the job).
.
Not to mention that all the OP was doing was redirecting to the local machine (127.0.0.1 is the local computer) so fetching the new information would always fail.

Last edited by DNSB; 08-02-2026 at 02:49 AM.
DNSB is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Zebedi's unexpected behavior Zebedi justRead.app 9 05-14-2026 05:14 AM
Unexpected behavior when editing enumerated columns ownedbycats Library Management 1 02-01-2022 04:02 AM
Unexpected behavior from check_library tlfamm Library Management 2 04-03-2014 10:37 PM
Unexpected behavior - Calibre 0.8 zdt0343 Calibre 2 12-11-2011 08:03 AM
unexpected behavior when bulk editing curantil Calibre 1 06-07-2010 06:45 PM


All times are GMT -4. The time now is 06:11 PM.


MobileRead.com is a privately owned, operated and funded community.