def change_root_directory(directory):
 try:
  os.chdir(directory)
  os.chroot(directory)
 except Exception as exc:
  error = DaemonOSEnvironmentError(('Unable to change root directory (%(exc)s)' % vars()))
  raise error

def change_root_directory ( directory ) : try : os . chdir ( directory ) os . chroot ( directory ) except Exception as exc : error = DaemonOSEnvironmentError ( ( 'Unable to change root directory (%(exc)s)' % vars ( ) ) ) raise error
change the root directory of this process .