diff --git a/src/calibre/devices/scanner.py b/src/calibre/devices/scanner.py index 96d61dcbd2..6657a2f26a 100644 --- a/src/calibre/devices/scanner.py +++ b/src/calibre/devices/scanner.py @@ -58,8 +58,8 @@ class DeviceScanner(object): def __init__(self, *args): if isosx and osx_scanner is None: raise RuntimeError('The Python extension usbobserver must be available on OS X.') - if not (isosx or iswindows) and not os.access(_DEVICES, os.R_OK): - raise RuntimeError('DeviceScanner requires %s to work.'%_DEVICES) + if not (isosx or iswindows) and (not os.access(_DEVICES, os.R_OK) and not libusb.has_library): + raise RuntimeError('DeviceScanner requires %s or libusb to work.'%_DEVICES) self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner self.devices = [] diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 0aa2ac25f8..db0a06886a 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -808,6 +808,9 @@ class BasicNewsRecipe(Recipe): ''' Create a generic cover for recipes that dont have a cover ''' + from calibre.gui2 import is_ok_to_use_qt + if not is_ok_to_use_qt(): + return False from calibre.gui2 import images_rc # Needed for access to logo images_rc if QApplication.instance() is None: QApplication([]) @@ -868,6 +871,7 @@ class BasicNewsRecipe(Recipe): else: cover_file.write(renderer.data) cover_file.flush() + return True def create_opf(self, feeds, dir=None): @@ -892,8 +896,8 @@ class BasicNewsRecipe(Recipe): cpath = getattr(self, 'cover_path', None) if cpath is None: pf = open(os.path.join(dir, 'cover.jpg'), 'wb') - self.default_cover(pf) - cpath = pf.name + if self.default_cover(pf): + cpath = pf.name if cpath is not None and os.access(cpath, os.R_OK): opf.cover = cpath manifest.append(cpath)