Encoding in open

This commit is contained in:
DarkCat09 2023-03-24 19:28:56 +04:00
parent 668c868a38
commit 78602c4ef9

View file

@ -45,12 +45,12 @@ def secret_key_check(name: SecretKey) -> None:
key_file = Path(f'/tmp/{name}')
if key_file.exists():
with key_file.open('rt') as f:
with key_file.open('rt', encoding='utf-8') as f:
key = f.read()
else:
key = secrets.token_hex(32)
with key_file.open('wt') as f:
with key_file.open('wt', encoding='utf-8') as f:
f.write(key)
settings_dict[name] = key