Ticket #4496 (closed defect: fixed)
Crash on adding several books to library
| Reported by: | grolm | Owned by: | norguhtar@… |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | FB2 Input | Version: | trunk |
| Keywords: | Cc: |
Description
I am adding a lot of files from lib.rus.ec archive in fb2 format. I do not need so much files but they are named as 1.fb2, 2.fb2, 3.fb2... Thus I add all files to find what I need. I use calibredb as
calibredb add -r /path/to/files
The following exception occurs:
Traceback (most recent call last):
File "/usr/bin/calibredb", line 16, in <module>
sys.exit(main())
File "/usr/lib/calibre/calibre/library/cli.py", line 617, in main
return command(args[2:], dbpath)
File "/usr/lib/calibre/calibre/library/cli.py", line 356, in command_add
do_add(get_db(dbpath, opts), args[1:], opts.one_book_per_directory, opts.recurse, opts.duplicates)
File "/usr/lib/calibre/calibre/library/cli.py", line 293, in do_add
dir_dups.extend(db.recursive_import(dir, single_book_per_directory=one_book_per_directory))
File "/usr/lib/calibre/calibre/library/database2.py", line 1689, in recursive_import
self.import_book_directory_multiple(dirpath[0], callback=callback)
File "/usr/lib/calibre/calibre/library/database2.py", line 1662, in import_book_directory_multiple
self.import_book(mi, formats)
File "/usr/lib/calibre/calibre/library/database2.py", line 1441, in import_book
self.set_metadata(id, mi)
File "/usr/lib/calibre/calibre/library/database2.py", line 1085, in set_metadata
self.set_series_index(id, mi.series_index, notify=False)
File "/usr/lib/calibre/calibre/library/database2.py", line 1285, in set_series_index
idx = float(idx)
ValueError: invalid literal for float(): 1994 01
As a result not all files added to database. Ubuntu 9.10. Calibre 0.6.13+dfsg-0ubuntu3.1
I propose the following solution: to add appropriate try/catch to decrease severity of such errors like this produced by malformed/unexpected metadata value.
Change History
comment:1 Changed 8 months ago by kovidgoyal
- Status changed from new to closed
- Resolution set to fixed
comment:2 Changed 8 months ago by grolm
- Status changed from closed to reopened
- Resolution fixed deleted
I have downloaded today version latest release available for linux 0.6.32 using
sudo python -c "import urllib2; exec urllib2.urlopen('http://status.calibre-ebook.com/linux_installer').read(); main()"
I still have the following crash:
Traceback (most recent call last): File "/tmp/init.py", line 48, in <module> File "/home/kovid/build/calibre/src/calibre/library/cli.py", line 621, in main File "/home/kovid/build/calibre/src/calibre/library/cli.py", line 360, in command_add File "/home/kovid/build/calibre/src/calibre/library/cli.py", line 297, in do_add File "/home/kovid/build/calibre/src/calibre/library/database2.py", line 1766, in recursive_import File "/home/kovid/build/calibre/src/calibre/library/database2.py", line 1739, in import_book_directory_multiple File "/home/kovid/build/calibre/src/calibre/library/database2.py", line 1516, in import_book File "/home/kovid/build/calibre/src/calibre/library/database2.py", line 1146, in set_metadata File "/home/kovid/build/calibre/src/calibre/library/database2.py", line 887, in set_cover File "/usr/lib/python2.6/site-packages/PIL/Image.py", line 654, in convert File "/usr/lib/python2.6/site-packages/PIL/ImageFile.py", line 192, in load IOError: image file is truncated (22 bytes not processed)
It stops adding of remaining fb2 files to database and I even do not know in what file the problem is because there is a lot of files.

Fixed in branch trunk. The fix will be in the next release.