diff --git a/gramps/plugins/export/exportpkg.py b/gramps/plugins/export/exportpkg.py index 26bed467e..7acc5c5a9 100644 --- a/gramps/plugins/export/exportpkg.py +++ b/gramps/plugins/export/exportpkg.py @@ -39,7 +39,7 @@ import tarfile if sys.version_info[0] < 3: from cStringIO import StringIO else: - from io import StringIO + import io from gramps.gen.ggettext import gettext as _ #------------------------------------------------------------------------ @@ -63,7 +63,7 @@ from gi.repository import Gtk # #------------------------------------------------------------------------- from gramps.gui.plug.export import WriterOptionBox -from exportxml import XmlWriter +from .exportxml import XmlWriter from gramps.gen.utils.file import media_path_full, get_unicode_path_from_file_chooser from gramps.gen.constfunc import win @@ -214,7 +214,10 @@ class PackageWriter(object): # select_clicked() # Write XML now - g = StringIO() + if sys.version_info[0] < 3: + g = StringIO() + else: + g = io.BytesIO() gfile = XmlWriter(self.db, self.user, 2) gfile.write_handle(g) tarinfo = tarfile.TarInfo('data.gramps') diff --git a/gramps/plugins/export/exportxml.py b/gramps/plugins/export/exportxml.py index 424e37f9c..16d775775 100644 --- a/gramps/plugins/export/exportxml.py +++ b/gramps/plugins/export/exportxml.py @@ -121,7 +121,7 @@ class GrampsXmlWriter(UpdateCallback): self.status = None - def write(self,filename): + def write(self, filename): """ Write the database to the specified file. """ @@ -180,7 +180,7 @@ class GrampsXmlWriter(UpdateCallback): if self.compress and _gzip_ok: try: - g = gzip.GzipFile(mode="wb",fileobj=handle) + g = gzip.GzipFile(mode="wb", fileobj=handle) except: g = handle else: