Handle KeyError in getuser (#59667)
This commit is contained in:
parent
c323815760
commit
f596cb19fd
2 changed files with 12 additions and 1 deletions
|
@ -23,13 +23,17 @@ async def async_get_system_info(hass: HomeAssistant) -> dict[str, Any]:
|
|||
"virtualenv": is_virtual_env(),
|
||||
"python_version": platform.python_version(),
|
||||
"docker": False,
|
||||
"user": getuser(),
|
||||
"arch": platform.machine(),
|
||||
"timezone": str(hass.config.time_zone),
|
||||
"os_name": platform.system(),
|
||||
"os_version": platform.release(),
|
||||
}
|
||||
|
||||
try:
|
||||
info_object["user"] = getuser()
|
||||
except KeyError:
|
||||
info_object["user"] = None
|
||||
|
||||
if platform.system() == "Windows":
|
||||
info_object["os_version"] = platform.win32_ver()[0]
|
||||
elif platform.system() == "Darwin":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue