diff --git a/src/calibre/utils/ipc/launch.py b/src/calibre/utils/ipc/launch.py index 508e302708..3a6344132d 100644 --- a/src/calibre/utils/ipc/launch.py +++ b/src/calibre/utils/ipc/launch.py @@ -167,7 +167,8 @@ class Worker(object): ''' exe = self.gui_executable if self.gui else self.executable env = self.env - env['ORIGWD'] = cwd or os.path.abspath(os.getcwd()) + env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps(cwd or + os.path.abspath(os.getcwdu()))) _cwd = cwd if priority is None: priority = prefs['worker_process_priority'] diff --git a/src/calibre/utils/pyconsole/interpreter.py b/src/calibre/utils/pyconsole/interpreter.py index 3cd0d94711..1c06f8102e 100644 --- a/src/calibre/utils/pyconsole/interpreter.py +++ b/src/calibre/utils/pyconsole/interpreter.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import sys, cPickle, os +import sys, cPickle, os, binascii from code import InteractiveInterpreter from Queue import Queue, Empty from threading import Thread @@ -130,7 +130,7 @@ class Interpreter(InteractiveInterpreter): # {{{ # }}} def connect(): - os.chdir(os.environ['ORIGWD']) + os.chdir(cPickle.loads(binascii.unhexlify(os.environ['ORIGWD']))) address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) key = unhexlify(os.environ['CALIBRE_WORKER_KEY']) return Client(address, authkey=key)