Encoding in open
This commit is contained in:
parent
668c868a38
commit
78602c4ef9
1 changed files with 2 additions and 2 deletions
|
@ -45,12 +45,12 @@ def secret_key_check(name: SecretKey) -> None:
|
||||||
key_file = Path(f'/tmp/{name}')
|
key_file = Path(f'/tmp/{name}')
|
||||||
|
|
||||||
if key_file.exists():
|
if key_file.exists():
|
||||||
with key_file.open('rt') as f:
|
with key_file.open('rt', encoding='utf-8') as f:
|
||||||
key = f.read()
|
key = f.read()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
key = secrets.token_hex(32)
|
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)
|
f.write(key)
|
||||||
|
|
||||||
settings_dict[name] = key
|
settings_dict[name] = key
|
||||||
|
|
Loading…
Reference in a new issue