diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py
index 51e23a1028..c0ea8ea197 100644
--- a/src/calibre/ebooks/fb2/fb2ml.py
+++ b/src/calibre/ebooks/fb2/fb2ml.py
@@ -127,8 +127,6 @@ class FB2MLizer(object):
aid = '%s#%s' % (page.href, aid)
if aid not in self.link_hrefs.keys():
self.link_hrefs[aid] = 'calibre_link-%s' % len(self.link_hrefs.keys())
- print aid,
- print self.link_hrefs[aid]
aid = self.link_hrefs[aid]
return '' % aid
@@ -174,9 +172,10 @@ class FB2MLizer(object):
tag_count = 0
if tag in TAG_IMAGES:
- if page.abshref(elem.attrib['src']) not in self.image_hrefs.keys():
- self.image_hrefs[page.abshref(elem.attrib['src'])] = '%s.jpg' % len(self.image_hrefs.keys())
- fb2_text += '' % self.image_hrefs[page.abshref(elem.attrib['src'])]
+ if elem.attrib.get('src', None):
+ if page.abshref(elem.attrib['src']) not in self.image_hrefs.keys():
+ self.image_hrefs[page.abshref(elem.attrib['src'])] = '%s.jpg' % len(self.image_hrefs.keys())
+ fb2_text += '' % self.image_hrefs[page.abshref(elem.attrib['src'])]
if tag in TAG_LINKS:
href = elem.get('href')
@@ -189,8 +188,6 @@ class FB2MLizer(object):
href += '#'
if href not in self.link_hrefs.keys():
self.link_hrefs[href] = 'calibre_link-%s' % len(self.link_hrefs.keys())
- print href,
- print self.link_hrefs[href]
href = self.link_hrefs[href]
fb2_text += '' % href
tag_count += 1