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']