From bfcecc646d41dab8b2460dea6ea0bdf28c8ea6a2 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Tue, 1 Jan 2013 11:15:45 +0000 Subject: [PATCH] 6265: can not make back up svn: r20923 --- gramps/plugins/export/exportpkg.py | 9 ++++++--- gramps/plugins/export/exportxml.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) 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: