def uid_to_user(uid):
 if ((uid is None) or (uid == '')):
  return ''
 sid = win32security.GetBinarySid(uid)
 try:
  (name, domain, account_type) = win32security.LookupAccountSid(None, sid)
  return name
 except pywinerror as exc:
  if (exc.winerror == 1332):
   return ''
  else:
   raise

def uid_to_user ( uid ) : if ( ( uid is None ) or ( uid == '' ) ) : return '' sid = win32security . GetBinarySid ( uid ) try : ( name , domain , account_type ) = win32security . LookupAccountSid ( None , sid ) return name except pywinerror as exc : if ( exc . winerror == 1332 ) : return '' else : raise
convert a uid to a user name cli example: .