From 10430797370f4a4b5dc6d8d420760d1551b0d810 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Oct 2010 10:02:23 -0600 Subject: [PATCH] Use unicode for all temp file paths. Fixes #7288 (calibre cannot work correctly if the temporary path contain non-ASCII characters) --- src/calibre/ptempfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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):