From b5218ca772824332c1c2a9baf76f6487193ff255 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 30 Nov 2013 11:51:05 +0530 Subject: [PATCH] Container: Handle path to temp directory being a symlink (common on OS X) --- src/calibre/ebooks/oeb/polish/container.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index ab20fb909a..8944c6ab17 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -794,7 +794,8 @@ class EpubContainer(Container): self.pathtoepub = pathtoepub if tdir is None: - tdir = os.path.abspath(os.path.realpath(PersistentTemporaryDirectory('_epub_container'))) + tdir = PersistentTemporaryDirectory('_epub_container') + tdir = os.path.abspath(os.path.realpath(tdir)) self.root = tdir with open(self.pathtoepub, 'rb') as stream: try: @@ -1002,7 +1003,8 @@ class AZW3Container(Container): self.pathtoazw3 = pathtoazw3 if tdir is None: - tdir = os.path.abspath(os.path.realpath(PersistentTemporaryDirectory('_azw3_container'))) + tdir = PersistentTemporaryDirectory('_azw3_container') + tdir = os.path.abspath(os.path.realpath(tdir)) self.root = tdir with open(pathtoazw3, 'rb') as stream: raw = stream.read(3)