From 220b49f1d7c7d2f26e42f750a408af8b32e89f17 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Oct 2009 15:43:34 -0600 Subject: [PATCH] Fix #3803 (mobi/prc > epub conversion failure) --- src/calibre/ebooks/mobi/reader.py | 3 +++ src/calibre/linux.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index a37285a47c..d3a154e32d 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -489,6 +489,9 @@ class MobiReader(object): mobi_version = self.book_header.mobi_version for i, tag in enumerate(root.iter(etree.Element)): tag.attrib.pop('xmlns', '') + for x in tag.attrib: + if ':' in x: + del tag.attrib[x] if tag.tag in ('country-region', 'place', 'placetype', 'placename', 'state', 'city', 'street', 'address', 'content'): tag.tag = 'div' if tag.tag == 'content' else 'span' diff --git a/src/calibre/linux.py b/src/calibre/linux.py index c0e76b8690..d22cbf7cbd 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -140,8 +140,8 @@ class PostInstall: for f in os.listdir('.'): if os.stat(f).st_uid == 0: os.rmdir(f) if os.path.isdir(f) else os.unlink(f) - if os.stat(config_dir).st_uid == 0: - os.rmdir(config_dir) + if os.stat(config_dir).st_uid == 0: + os.rmdir(config_dir) if warn is None and self.warnings: self.info('There were %d warnings'%len(self.warnings))