diff --git a/src/calibre/ptempfile.py b/src/calibre/ptempfile.py index 16a1ef4ce4..0aa71770a0 100644 --- a/src/calibre/ptempfile.py +++ b/src/calibre/ptempfile.py @@ -7,7 +7,8 @@ being closed. """ import tempfile, os, atexit, binascii, cPickle -from calibre import __version__, __appname__ +from calibre import __version__, __appname__, isbytestring +from calibre.constants import filesystem_encoding def cleanup(path): try: @@ -42,6 +43,8 @@ def base_dir(): _base_dir = tempfile.mkdtemp(prefix='%s_%s_tmp_'%(__appname__, __version__)) atexit.register(remove_dir, _base_dir) + if isbytestring(_base_dir): + _base_dir = _base_dir.decode(filesystem_encoding) return _base_dir class PersistentTemporaryFile(object):