Specify UTF-8 encoding for saving notebook as script.

This commit is contained in:
Thomas Kluyver 2012-01-30 21:48:05 +00:00
parent 53b10b861c
commit abd3989bb6

View File

@ -213,7 +213,7 @@ class NotebookManager(LoggingConfigurable):
if self.save_script: if self.save_script:
pypath = os.path.splitext(path)[0] + '.py' pypath = os.path.splitext(path)[0] + '.py'
try: try:
with io.open(pypath,'w') as f: with io.open(pypath,'w', encoding='utf-8') as f:
current.write(nb, f, u'py') current.write(nb, f, u'py')
except Exception as e: except Exception as e:
raise web.HTTPError(400, u'Unexpected error while saving notebook as script: %s' % e) raise web.HTTPError(400, u'Unexpected error while saving notebook as script: %s' % e)