mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Nicer error message when writing the thumbnail width to the cache fails
This commit is contained in:
parent
40714d02c5
commit
452bb19df1
@ -7,8 +7,8 @@ import datetime, os, platform, re, shutil, time, unicodedata, zlib
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from xml.sax.saxutils import escape
|
from xml.sax.saxutils import escape
|
||||||
|
|
||||||
from calibre import (prepare_string_for_xml, strftime, force_unicode,
|
from calibre import (
|
||||||
isbytestring, replace_entities)
|
prepare_string_for_xml, strftime, force_unicode, isbytestring, replace_entities, as_unicode)
|
||||||
from calibre.constants import isosx, cache_dir
|
from calibre.constants import isosx, cache_dir
|
||||||
from calibre.customize.conversion import DummyReporter
|
from calibre.customize.conversion import DummyReporter
|
||||||
from calibre.customize.ui import output_profiles
|
from calibre.customize.ui import output_profiles
|
||||||
@ -4442,8 +4442,12 @@ class CatalogBuilder(object):
|
|||||||
|
|
||||||
# Write thumb_width to the file, validating cache contents
|
# Write thumb_width to the file, validating cache contents
|
||||||
# Allows detection of aborted catalog builds
|
# Allows detection of aborted catalog builds
|
||||||
with ZipFile(self.thumbs_path, mode='a') as zfw:
|
try:
|
||||||
zfw.writestr('thumb_width', self.opts.thumb_width)
|
with ZipFile(self.thumbs_path, mode='a') as zfw:
|
||||||
|
zfw.writestr('thumb_width', self.opts.thumb_width)
|
||||||
|
except Exception as err:
|
||||||
|
raise ValueError('There was an error writing to the thumbnail cache: %s\n'
|
||||||
|
'Try deleting it. Underlying error: %s' % (force_unicode(self.thumbs_path), as_unicode(err)))
|
||||||
|
|
||||||
self.thumbs = thumbs
|
self.thumbs = thumbs
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user