danielballan/nbexamples

ascii error previewing notebook on python 2.7

Closed this issue · 1 comments

Using Python 2.7, I get the following error clicking the Preview button for pretty much any notebook.

[E 08:01:29.312 NotebookApp] Uncaught exception GET /examples/preview?example_id=/Users/parente/Desktop/notebooks/test_bookshelf.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/examples/preview?example_id=/Users/parente/Desktop/notebooks/test_bookshelf.ipynb', version='HTTP/1.1', remote_ip='::1', headers={'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch', 'Host': 'localhost:8888', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8888/tree', 'Cookie': '_ga=GA1.1.1186548457.1445272720', 'Upgrade-Insecure-Requests': '1'})
    Traceback (most recent call last):
      File "/Users/parente/.virtualenv/notebook-stable/lib/python2.7/site-packages/tornado/web.py", line 1443, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/Users/parente/.virtualenv/notebook-stable/lib/python2.7/site-packages/tornado/web.py", line 2800, in wrapper
        return method(self, *args, **kwargs)
      File "/Users/parente/.virtualenv/notebook-stable/lib/python2.7/site-packages/nbexamples/handlers.py", line 100, in get
        self.finish(self.manager.preview_example(example_id))
      File "/Users/parente/.virtualenv/notebook-stable/lib/python2.7/site-packages/nbexamples/handlers.py", line 77, in preview_example
        return output.decode()
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 205678: ordinal not in range(128)

In an offline conversation, @parente and I agreed that we will declare nbexamples Python 3 only. Deployments of nbexamples are likely at a scale where JupyterHub is being used too, and JupyterHub is Python 3 only.

To be clear, this does not restrict the kernels to Python 3, only the notebook server app.