Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use utf-8 encoding in execute_api example #921

Merged
merged 1 commit into from
Jan 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/source/execute_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ in which folder to execute the notebook.

**Save**: Finally, save the resulting notebook with::

with open('executed_notebook.ipynb', 'wt') as f:
with open('executed_notebook.ipynb', 'w', encoding='utf-8') as f:
nbformat.write(nb, f)

That's all. Your executed notebook will be saved in the current folder
Expand Down Expand Up @@ -122,7 +122,7 @@ and raise a ``CellExecutionError``. Conveniently, the source cell causing
the error and the original error name and message are also printed.
After an error, we can still save the notebook as before::

with open('executed_notebook.ipynb', mode='wt') as f:
with open('executed_notebook.ipynb', mode='w', encoding='utf-8') as f:
nbformat.write(nb, f)

The saved notebook contains the output up until the failing cell,
Expand All @@ -143,7 +143,7 @@ A useful pattern to execute notebooks while handling errors is the following::
print(msg)
raise
finally:
with open(notebook_filename_out, mode='wt') as f:
with open(notebook_filename_out, mode='w', encoding='utf-8') as f:
nbformat.write(nb, f)

This will save the executed notebook regardless of execution errors.
Expand Down