From db67eb621bfc73647366e9565fda2c2c7a9c5350 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Mar 2013 12:06:17 +0530 Subject: [PATCH] Dont fail to launch worker process if cwd no longer exists --- src/calibre/utils/ipc/launch.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/ipc/launch.py b/src/calibre/utils/ipc/launch.py index 3a6344132d..d21f0ec8f6 100644 --- a/src/calibre/utils/ipc/launch.py +++ b/src/calibre/utils/ipc/launch.py @@ -167,8 +167,14 @@ class Worker(object): ''' exe = self.gui_executable if self.gui else self.executable env = self.env - env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps(cwd or - os.path.abspath(os.getcwdu()))) + try: + env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps( + cwd or os.path.abspath(os.getcwdu()))) + except EnvironmentError: + # cwd no longer exists + env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps( + cwd or os.path.expanduser(u'~'))) + _cwd = cwd if priority is None: priority = prefs['worker_process_priority']