# HG changeset patch # User Dennis Fink # Date 2014-01-23 11:07:03 # Node ID b491f9fa59bd0e6af906c9e0620f9bcf91872560 # Parent f9bac59625ab823a45b78542166120b9e207e6d6 added encoding parameter to open diff --git a/ennstatus/api/functions.py b/ennstatus/api/functions.py --- a/ennstatus/api/functions.py +++ b/ennstatus/api/functions.py @@ -87,7 +87,8 @@ def update_server(server, ip): try: filename = ''.join(['data/', server['server_name'].lower(), '.json']) - with open(filename, 'w') as fb: + + with open(filename, 'w', encoding='utf-8') as fb: json.dump(server, fb) return server diff --git a/ennstatus/donate/functions.py b/ennstatus/donate/functions.py --- a/ennstatus/donate/functions.py +++ b/ennstatus/donate/functions.py @@ -8,7 +8,7 @@ def load_csv(date): filename = '.'.join([date, 'csv']) path = os.path.join('donations', filename) - with open(path) as csvfile: + with open(path, encoding='utf-8', newline='') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') for row in csvreader: diff --git a/ennstatus/status/functions.py b/ennstatus/status/functions.py --- a/ennstatus/status/functions.py +++ b/ennstatus/status/functions.py @@ -9,7 +9,7 @@ def _load_single_server(name): filename = ''.join(['data/', name, '.json']) try: - with open(filename) as f: + with open(filename, encoding='utf-8') as f: return ''.join(f.readlines()) except IOError: return False @@ -66,7 +66,7 @@ def all_servers(): for root, _, files in os.walk('data'): for f in _get_json_files(root, files): - with open(f) as fb: + with open(f, encoding='utf-8') as fb: try: server = json.load(fb) except ValueError: