Don't print out error messages when no cache is present on a device

This commit is contained in:
Kovid Goyal 2010-05-17 12:46:14 -06:00
parent 78bb3a2753
commit 38b1f35ff7

View File

@ -277,8 +277,10 @@ class USBMS(CLI, Device):
bl = []
js = []
need_sync = False
cache_file = cls.normalize_path(os.path.join(prefix, name))
if os.access(cache_file, os.R_OK):
try:
with open(cls.normalize_path(os.path.join(prefix, name)), 'rb') as f:
with open(cache_file, 'rb') as f:
js = json.load(f, encoding='utf-8')
for item in js:
book = cls.book_class(prefix, item.get('lpath', None))
@ -290,6 +292,8 @@ class USBMS(CLI, Device):
traceback.print_exc()
bl = []
need_sync = True
else:
need_sync = True
return bl, need_sync
@classmethod