mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-04-15 23:47:24 +02:00
Fixed PLW1514 (unspecified-encoding): open in text mode without explicit encoding argument
This commit is contained in:
committed by
Joshua Tauberer
parent
a02b59d4e4
commit
0e9193651d
@@ -38,7 +38,7 @@ for date, ip in accesses:
|
||||
# Since logs are rotated, store the statistics permanently in a JSON file.
|
||||
# Load in the stats from an existing file.
|
||||
if os.path.exists(outfn):
|
||||
with open(outfn) as f:
|
||||
with open(outfn, encoding="utf-8") as f:
|
||||
existing_data = json.load(f)
|
||||
for date, count in existing_data:
|
||||
if date not in by_date:
|
||||
@@ -51,5 +51,5 @@ by_date = sorted(by_date.items())
|
||||
by_date.pop(-1)
|
||||
|
||||
# Write out.
|
||||
with open(outfn, "w") as f:
|
||||
with open(outfn, "w", encoding="utf-8") as f:
|
||||
json.dump(by_date, f, sort_keys=True, indent=True)
|
||||
|
||||
Reference in New Issue
Block a user