diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py
index 9280aec85c..18009a9a9f 100644
--- a/src/calibre/ebooks/epub/output.py
+++ b/src/calibre/ebooks/epub/output.py
@@ -125,7 +125,9 @@ class EPUBOutput(OutputFormatPlugin):
%(title)s
-
+
+
s)
+
%(author)s
Produced by %(app)s
@@ -196,7 +198,7 @@ class EPUBOutput(OutputFormatPlugin):
images_rc
m = self.oeb.metadata
title = unicode(m.title[0])
- a = [unicode(x) for x in m.creators if m.role == 'aut']
+ a = [unicode(x) for x in m.creator if x.role == 'aut']
author = authors_to_string(a)
if QApplication.instance() is None: QApplication([])
f = QFile(':/library')
diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py
index 1f2df923dc..8941f97304 100644
--- a/src/calibre/ebooks/oeb/base.py
+++ b/src/calibre/ebooks/oeb/base.py
@@ -694,7 +694,6 @@ class Metadata(object):
def to_opf2(self, parent=None):
nsmap = self._opf2_nsmap
nsrmap = dict((value, key) for key, value in nsmap.items())
- nsmap.pop('opf', '')
elem = element(parent, OPF('metadata'), nsmap=nsmap)
for term in self.items:
for item in self.items[term]:
diff --git a/src/calibre/ebooks/oeb/output.py b/src/calibre/ebooks/oeb/output.py
index 4df8c0f679..123d485b00 100644
--- a/src/calibre/ebooks/oeb/output.py
+++ b/src/calibre/ebooks/oeb/output.py
@@ -3,7 +3,7 @@ __license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal '
__docformat__ = 'restructuredtext en'
-import os
+import os, re
from lxml import etree
@@ -34,6 +34,10 @@ class OEBOutput(OutputFormatPlugin):
if root is not None:
raw = etree.tostring(root, pretty_print=True,
encoding='utf-8', xml_declaration=True)
+ if key == OPF_MIME:
+ # Needed as I can't get lxml to output opf:role and
+ # not output as well
+ raw = re.sub(r'(<[/]{0,1})opf:', r'\1', raw)
with open(href, 'wb') as f:
f.write(raw)