diff --git a/server/map_handler/add_new_lake.py b/server/map_handler/add_new_lake.py index 559385a8ed7ca0b4f1a16168f1078fb7c993ec79..46a2a4809c573466b97acb25efef456fb783e928 100644 --- a/server/map_handler/add_new_lake.py +++ b/server/map_handler/add_new_lake.py @@ -188,16 +188,17 @@ def write_json_to_file(lake_name: str, map_data: dict): json.dump(map_data, f) # Read all_system_lakes.json - with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'r') as file: - data = json.load(file) + with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'r', encoding='utf-8') as f: + data = json.load(f) # Check if the lake name exists in the list if lake_name not in data: data.append(lake_name) # Only append to list if it does not already exist # Update all_lake_names.json with new lake name - with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'w') as file: - json.dump(data, file, ensure_ascii=False, indent=2) + with open(LAKE_RELATIONS_PATH + 'all_lake_names.json', 'w', encoding='utf-8') as f: + json.dump(data, f, ensure_ascii=False, indent=2) + # Plotting the map can take a considerable amount of time, especially when creating maps with many