View Single Post
Old 03-02-2025, 06:57 AM   #16
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,478
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
I still don't know what happens or why it only happens with an ereader, but if I change the template to this:
Code:
program:
  new_des = '';
  pref="#C:";
  for i in '#des':
    j = pref & i;
    new_des = list_union(new_des, j, ',')
  rof;
  new_des
, it works, so I'm happy with that.
Where did you put that template? If you put it in a custom column definition or in the Kobo driver, it sort-of confirms what I thought -- that there is a problem with stored user template functions and possibly stored templates, in this context. Managing their availability to threads and processes is a nightmare. Python and GPM templates are stored as the template text and compiled as needed so they are by definition avaiiable when needed.

Another thought -- too late given you have a solution. Were the books with the problem marked as "On Device" when the reader was connected? If not then the problem could have been historical because the value in the Kobo database would be used. The fact that changing the template fixed it argues against this theory. The fact that you weren't getting exceptions in the log argues for it.

I know you prefer python over the template language. This python template should do the same thing as the GPM template above.
Code:
python:
def evaluate(book, context):
	pref="#C:"
	new_list = [pref + v for v in book.get('#des', [])]
	return ', '.join(new_list)
chaley is offline   Reply With Quote