Skip to content

Commit

Permalink
fix issue: json.load in python3 doesn't have 'encoding' paramteter
Browse files Browse the repository at this point in the history
Signed-off-by: Fei Su <fei.su@cloud.com>
  • Loading branch information
acefei committed Jan 29, 2024
1 parent 9c4fb81 commit 51ca753
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/mail-alarm
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def load_mail_language(mail_language):
mail_language_file = os.path.join(
mail_language_pack_path, mail_language + ".json"
)
with open(mail_language_file, "r") as fileh:
return json.load(fileh, encoding="utf-8")
with open(mail_language_file, encoding="utf-8") as fileh:
return json.load(fileh)
except IOError:
log_err('Read mail language pack error:["%s"]' % (mail_language_file))
return None
Expand Down Expand Up @@ -1031,6 +1031,7 @@ def main():
config = config.replace(s, r)

# Write out a temporary file containing the new config
temp_file_path = ""
try:
with tempfile.NamedTemporaryFile(
prefix="mail-", dir="/tmp", delete=False
Expand Down

0 comments on commit 51ca753

Please sign in to comment.