def change_process_owner(uid, gid):
 try:
  os.setgid(gid)
  os.setuid(uid)
 except Exception as exc:
  error = DaemonOSEnvironmentError(('Unable to change file creation mask (%(exc)s)' % vars()))
  raise error

def change_process_owner ( uid , gid ) : try : os . setgid ( gid ) os . setuid ( uid ) except Exception as exc : error = DaemonOSEnvironmentError ( ( 'Unable to change file creation mask (%(exc)s)' % vars ( ) ) ) raise error
change the owning uid and gid of this process .