View Single Post
Old 07-11-2022, 06:08 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
It works for me, of course. These 'sometimes' problems are a big pain.

What I did:
  • Updated to latest source.
  • Created an empty configuration directory to remove any possible plugin influence.
  • Created a library containing your metadata.db
  • Ran calibre, which went through the welcome wizard. I pointed it at the library containing your database.
  • Your aamy_ifempty() function was there.
  • I created a composite column calling your function. It shows the correct value.
To help trace this down I added some logging to calibre.db.backend.py. The source file is attached.

Here is the log when I ran it:
Spoiler:
Code:
c:\CBH_Data\calibre.git>test_calibre_temp.bat
c:\CBH_Data\calibre.git>set CALIBRE_CONFIG_DIRECTORY=C:\CBH_Data\calibre.git\config_test_temp
c:\CBH_Data\calibre.git>"c:\Program Files\calibre2\calibre-debug" -g

calibre 6.0*  embedded-python: True
Windows-10-10.0.19044 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19044')
Python 3.10.1
Windows: ('10', '10.0.19044', '', 'Multiprocessor Free')
Interface language: en_GB
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.20] splash screen shown
[0.20] Initializing db...
backend.__init__ - set template functions aamy_ifempty
backend.set_user_template_functions 1 aamy_ifempty
backend.set_user_template_functions 2 add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
backend.get_user_template_functions aamy_ifempty
backend.set_global_state aamy_ifempty
backend.get_user_template_functions aamy_ifempty
[0.20] db initialized
[0.20] Constructing main UI...
backend.get_template_functions add, and, approximate_formats, arguments, assign, author_links, author_sorts, book_count, book_values, booksize, capitalize, character, check_yes_no, ceiling, cmp, connected_device_name, connected_device_uuid, contains, count, list_count, current_library_name, current_library_path, current_virtual_library_name, date_arithmetic, days_between, divide, eval, first_non_empty, field, field_exists, finish_formatting, first_matching_cmp, floor, format_date, format_number, formats_modtimes, formats_paths, formats_sizes, fractional_part, globals, has_cover, human_readable, identifier_in_list, ifempty, language_codes, language_strings, in_list, list_contains, is_marked, list_count_matching, count_matching, list_difference, list_equals, list_intersection, list_item, list_join, list_re, list_re_group, list_remove_duplicates, list_sort, list_split, list_union, merge_lists, lookup, lowercase, mod, multiply, not, ondevice, or, print, rating_to_stars, range, raw_field, raw_list, re, re_group, round, select, series_sort, set_globals, shorten, strcat, strcat_max, strcmp, str_in_list, strlen, subitems, sublist, substr, subtract, swap_around_articles, swap_around_comma, switch, template, test, titlecase, today, transliterate, uppercase, urls_from_identifiers, user_categories, virtual_libraries, annotation_count, aamy_ifempty
[1.22] main UI initialized...
[1.22] Hiding splash screen
Starting QuickView
[1.50] splash screen hidden
[1.50] Started up in 1.50 seconds with 1 books
backend.close - unloading template functions 32d3fa1c-9a4a-450a-a422-e0dcface23d5

c:\CBH_Data\calibre.git>


To make sure we are running the same thing, I am attaching my configuration folder (zipped), the library folder (zipped).
Attached Files
File Type: zip config_test_temp.zip (14.5 KB, 182 views)
File Type: zip Library.test_temp.zip (114.5 KB, 189 views)
File Type: zip backend.py.zip (19.6 KB, 179 views)
chaley is offline   Reply With Quote