Uncaught exception GET when running the .ipynb file.
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
When I tried to run a .ipynb file it gives errors like these:
```
[E 20:12:10.596 NotebookApp] Uncaught exception GET /api/contents/phg_bike.ipynb?type=notebook&_=1586045529162 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents/phg_bike.ipynb?type=notebook&_=1586045529162', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/tornado/concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/notebook/services/contents/handlers.py", line 112, in get
path=path, type=type, format=format, content=content,
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/notebook/services/contents/filemanager.py", line 433, in get
model = self._notebook_model(path, content=content)
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/notebook/services/contents/filemanager.py", line 392, in _notebook_model
self.mark_trusted_cells(nb, path)
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/notebook/services/contents/manager.py", line 503, in mark_trusted_cells
trusted = self.notary.check_signature(nb)
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/nbformat/sign.py", line 438, in check_signature
signature = self.compute_signature(nb)
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/nbformat/sign.py", line 417, in compute_signature
for b in yield_everything(nb):
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/nbformat/sign.py", line 272, in yield_everything
for b in yield_everything(value):
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/nbformat/sign.py", line 276, in yield_everything
for b in yield_everything(element):
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/nbformat/sign.py", line 272, in yield_everything
for b in yield_everything(value):
File "/Users/liuzheng/Library/Python/2.7/lib/python/site-packages/nbformat/sign.py", line 281, in yield_everything
yield str(obj).encode('utf8')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 10: ordinal not in range(128)
[W 20:12:10.604 NotebookApp] Unhandled error
[E 20:12:10.605 NotebookApp] {
"Accept-Language": "en,zh-CN;q=0.9,zh;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"X-Xsrftoken": "2|c729d102|09b2805027c63e1f8d91b47e1e4db605|1586044950",
"Sec-Fetch-Site": "same-origin",
"Host": "localhost:8888",
"Accept": "application/json, text/javascript, */*; q=0.01",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
"Connection": "keep-alive",
"X-Requested-With": "XMLHttpRequest",
"Sec-Fetch-Mode": "cors",
"Referer": "http://localhost:8888/notebooks/phg_bike.ipynb",
"Cookie": "_xsrf=2|c729d102|09b2805027c63e1f8d91b47e1e4db605|1586044950; username-localhost-8888=\"2|1:0|10:1586045528|23:username-localhost-8888|44:MTYzMGU3MTJlYzA2NGNlY2JmMmIwZjUwNDI3Y2UyODQ=|f9e6088b314d5d72e0181ebb4d0c61746ef52576848eeb9f0a35c2da195e5f83\"",
"Sec-Fetch-Dest": "empty"
}
[E 20:12:10.605 NotebookApp] 500 GET /api/contents/phg_bike.ipynb?type=notebook&_=1586045529162 (::1) 70.59ms referer=http://localhost:8888/notebooks/phg_bike.ipynb
[W 20:12:11.098 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js (::1) 16.13ms referer=http://localhost:8888/notebooks/phg_bike.ipynb
```
Contributor guide
Research direction
Start with notebook/services/contents/handlers.py and notebook/services/contents/filemanager.py, then follow the traceback into notebook/services/contents/manager.py and nbformat/sign.py. Reproduce the GET request for a notebook containing the reported non-ASCII character and inspect the existing signing path. Done means the notebook contents request no longer returns 500 and the traceback is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100