|
![]() |
|
Thread Tools | Search this Thread |
![]() |
#1 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2025
Device: Kindle Paperwhite
|
![]()
Hello Calibre Developers and Community,
I am experiencing an extremely unusual and persistent problem with Calibre on my macOS system, which has progressed from template functions not working to fundamental configuration instability. I've exhausted all standard troubleshooting steps and need your expert assistance. Keep in mind I'm a super noob. I'm banging my head and hands against the wall at this point. My System Details: macOS Version: [Sequoia 15.5] Calibre Version: [8.4.0] Security Software: None Full debug log is attached.txt My primary issue began with Calibre's template language functions consistently failing. For example, a simple custom column using {if(1, '✅', '❌')} or {if(1, 'TRUE', 'FALSE')} would return an error like: "unknown field if..." or "unknown function if". Basic field substitutions like {title} do work. Here is what I have done so far: Multiple Clean Reinstalls: Exited Calibre. Dragged calibre.app to Trash. Manually deleted any calibre folders found in ~/Library/Application Support/ and ~/Library/Preferences/. Emptied Trash. Downloaded a fresh installer from calibre-ebook.com and reinstalled. Outcome: Problem persisted. macOS Update: Updated macOS to the latest available version. Outcome: No change. Testing in a New macOS User Account: Created a completely new, standard macOS user account ("Calibre Test User"). Installed a fresh copy of Calibre in this new account and created a new, empty library. Initial Outcome: The calibre configuration folder was initially created in the incorrect location (~/Library/Preferences/calibre/) instead of ~/Library/Application Support/calibre/. The template function issue remained. After that didn't work, I manually deleted calibre folders from both ~/Library/Application Support/ and ~/Library/Preferences/. Then, I launched Calibre from Terminal using the CALIBRE_CONFIG_DIRECTORY environment variable to explicitly force the correct path: CALIBRE_CONFIG_DIRECTORY="/Users/Calibre Test User/Library/Application Support/calibre" "/Applications/calibre.app/Contents/MacOS/calibre" Outcome: This successfully created and populated the calibre configuration folder in ~/Library/Application Support/calibre/. Template Test After This: A complex template (e.g., {#pages:|Pages: |}{#genre_without_top_level:subitems(0,1)| - |}) then returned "TEMPLATE ERROR Value: unknown field #pages". This told me some parsing was occurring, which seemed like progress to me. However, when reverting to {if(1, 'SUCCESS', 'FAILURE')}, the error changed to "unknown field if...". After the above steps, when I tried to restart Calibre normally (not from Terminal via the environment variable), one of two things happened: The Calibre Startup Wizard appeared, indicating Calibre had completely lost its configuration. The calibre configuration folder was now present in BOTH ~/Library/Application Support/ AND ~/Library/Preferences/. Is Calibre confused?? AND THEN when attempting to define a custom Python template function (field_exists) in Preferences → Advanced → Template functions I got this error: "EXCEPTION: Formatter: if statement: expected 'then', found 'is' near 'mi' on line 2" Man, maybe all of this is my fault?? I don't actually know but I would be really really grateful for some feedback or help. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,242
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
~/Library/Preferences/Calibre is the correct location for calibre configuration files, I suggest you stop trying to change it. If you really do want to change it, then set the environment variable system wide, which admittedly apple makes almost impossible to do on macOS. Read https://manual.calibre-ebook.com/cus...ment-variables
As for your template failing, I dont maintain the template language so cant say off the top of my head but your complex template is likely referring to a column that doesnt exist in your calibre library and your simple template has incorrect syntax. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,358
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
When asking questions about templates it is generally useful to include the templates.
Code:
{if(1, 'SUCCESS', 'FAILURE')} Quote:
EDIT: The calibre template language manual might be useful. Last edited by chaley; 05-24-2025 at 06:23 AM. |
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,358
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Moderator Notice
This thread doesn't belong in the development subforum as you aren't proposing developing anything. Moved to the library subforum. |
![]() |
![]() |
![]() |
#5 | |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2025
Device: Kindle Paperwhite
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,364
Karma: 145488914
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
There is a plugin to backup your configuration directory so if you do have a problem, you'll have a backup to go back to.
https://www.mobileread.com/forums/sh...d.php?t=366033 |
![]() |
![]() |
![]() |
Tags |
configuration folder, error, function, parsing |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Template functions: where to find them? | Terisa de morgan | Library Management | 1 | 09-03-2023 07:05 PM |
Template functions not showing return value (calibre 6.5) | tamaracks | Library Management | 4 | 09-21-2022 11:20 AM |
Calibre 6 - problem loading user-defined template functions | davidfor | Library Management | 4 | 07-12-2022 04:37 AM |
Using built-in template functions in a custom template function | ilovejedd | Library Management | 4 | 01-28-2018 12:20 PM |
URGENT HELP!! epub3 template? | pluma | ePub | 3 | 11-27-2016 06:22 PM |