diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index b11a3f298c..1eefe0001d 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -2626,7 +2626,10 @@ class ITUNES(DriverBase): None, level=UserFeedback.WARN) fnames = zf_opf.namelist() - opf = [x for x in fnames if '.opf' in x][0] + try: + opf = [x for x in fnames if '.opf' in x][0] + except: + opf = None if opf: opf_tree = etree.fromstring(zf_opf.read(opf)) md_els = opf_tree.xpath('.//*[local-name()="metadata"]') diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index b803a7bd68..c86458c901 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -124,8 +124,15 @@ class Stylizer(object): def __init__(self, tree, path, oeb, opts, profile=None, extra_css='', user_css=''): + from calibre.customize.ui import input_profiles self.oeb, self.opts = oeb, opts - self.profile = opts.input_profile + self.profile = None + for x in input_profiles(): + if x.short_name == 'sony': + self.profile = x + break + if self.profile is None: + self.profile = opts.input_profile self.logger = oeb.logger item = oeb.manifest.hrefs[path] basename = os.path.basename(path)