Changeset - b491f9fa59bd
[Not reviewed]
default
0 3 0
Dennis Fink - 11 years ago 2014-01-23 11:07:03
dennis.fink@c3l.lu
added encoding parameter to open
3 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/functions.py
Show inline comments
 
@@ -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
ennstatus/donate/functions.py
Show inline comments
 
@@ -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:
ennstatus/status/functions.py
Show inline comments
 
@@ -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:
0 comments (0 inline, 0 general)