Skip to content

Commit

Permalink
Use io.open in notebookapp.py to fix #4303
Browse files Browse the repository at this point in the history
Following the discussion at #4340, in Python 2 we need `io.open`
rather than `open` if using a file descriptor rather than a file name.
  • Loading branch information
slel authored Jan 16, 2019
1 parent 536c30e commit f8d7d40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ def launch_browser(self):

# Write a temporary file to open in the browser
fd, open_file = tempfile.mkstemp(suffix='.html')
with open(fd, 'w', encoding='utf-8') as fh:
with io.open(fd, 'w', encoding='utf-8') as fh:
self._write_browser_open_file(uri, fh)
else:
open_file = self.browser_open_file
Expand Down

0 comments on commit f8d7d40

Please sign in to comment.