handle chmod for windows

This commit is contained in:
htmltiger 2021-12-13 19:07:02 +00:00 committed by GitHub
parent 24b07092c6
commit 73d2055a20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,7 +74,10 @@ async def websocket_create(hass, connection, msg):
if not os.path.isdir(dirnm):
os.makedirs(dirnm, exist_ok=True)
with AtomicWriter(fullpath, overwrite=True).open() as fdesc:
os.fchmod(fdesc.fileno(), 0o644)
try:
os.fchmod(fdesc.fileno(), 0o644)
except:
pass
fdesc.write(content)
except:
res = "Saving Failed"