##// END OF EJS Templates
Fix writing JSON on Python 2
Thomas Kluyver -
Show More
@@ -7,6 +7,7 b' import os'
7 7 import io
8 8 from tornado import web
9 9
10 from IPython.utils.py3compat import PY3
10 11 from ...base.handlers import IPythonHandler, json_errors
11 12
12 13 def recursive_update(target, new):
@@ -68,8 +69,13 b' class ConfigHandler(IPythonHandler):'
68 69 update = self.get_json_body()
69 70 recursive_update(section, update)
70 71
71 with io.open(filename, 'w', encoding='utf-8') as f:
72 if PY3:
73 f = io.open(filename, 'w', encoding='utf-8')
74 else:
75 f = open(filename, 'wb')
76 with f:
72 77 json.dump(section, f)
78
73 79 self.set_status(204)
74 80
75 81
General Comments 0
You need to be logged in to leave comments. Login now