View Single Post
Old 07-14-2023, 09:24 PM   #584
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,203
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by Rellwood View Post
Hi!
I am trying to import my GR library list, it has pages and number of ratings. The columns are {0:,d} intengers.

I am getting the following error:
calibre, version 6.19.1
ERROR: Failed:

Traceback (most recent call last):
File "calibre_plugins.import_list.page_persist", line 42, in to_int
ValueError: could not convert string to float: '202,520'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre_plugins.import_list.page_persist", line 150, in do_it
File "calibre_plugins.import_list.page_persist", line 459, in pd_callback
File "calibre_plugins.import_list.page_persist", line 316, in _apply_metadata_updates
File "calibre_plugins.import_list.page_persist", line 369, in _update_mi_for_book
File "calibre_plugins.import_list.page_persist", line 405, in _update_mi_custom_column
File "calibre_plugins.import_list.page_persist", line 44, in to_int
ValueError

Can someone help?
Python functions to convert strings to numerals (int and float) do not handle numbers with commas. Until kiwidude responds to this and decides whether he wants to make the to_int() function capable of removing these automatically, you should remove the commas yourself from your csv column using a program like excel.
capink is offline   Reply With Quote