簡體   English   中英

Jupyter 筆記本:打開 Python 文件時出現錯誤 500

[英]Jupyter Notebook: Error 500 while opening Python file

我已經下載了 Jupyter Notebook 並嘗試制作一個新的 Python 3 文件(名稱:Letovo_olympiad.ipynb)。 然后我打開它並捕獲了錯誤500(地址:http://localhost:8888/notebooks/Downloads/Python%20files/Letovo_olympiad.ipynb)。

來自終端的特定錯誤信息:

[E 13:35:28.142 NotebookApp] Uncaught exception GET /notebooks/Downloads/Python%20files/Letovo_olympiad.ipynb (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Downloads/Python%20files/Letovo_olympiad.ipynb', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.9/site-packages/tornado/web.py", line 1704, in _execute
result = await result
File "/opt/anaconda3/lib/python3.9/site-packages/tornado/gen.py", line 775, in run
yielded = self.gen.send(value)
File "/opt/anaconda3/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 94, in get
self.write(self.render_template('notebook.html',
File "/opt/anaconda3/lib/python3.9/site-packages/notebook/base/handlers.py", line 511, in render_template
return template.render(**ns)
File "/Users/alex0758/.local/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/Users/alex0758/.local/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
extends "page.html" %}
File "/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/page.html", line 154, in top-level template code
block header %}
File "/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/notebook.html", line 115, in block 'header'
for exporter in get_frontend_exporters() %}
File "/opt/anaconda3/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 40, in get_frontend_exporters
for name in get_export_names():
File "/Users/alex0758/.local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 147, in get_export_names
e = get_exporter(exporter_name)(config=config)
File "/Users/alex0758/.local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 106, in get_exporter
if getattr(exporter(config=config), "enabled", True):
File "/Users/alex0758/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 342, in __init__
super().__init__(config=config, **kw)
File "/Users/alex0758/.local/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 118, in __init__
self._init_preprocessors()
File "/Users/alex0758/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 508, in _init_preprocessors
conf = self._get_conf()
File "/Users/alex0758/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 528, in _get_conf
if conf_path.exists():
File "/opt/anaconda3/lib/python3.9/pathlib.py", line 1424, in exists
self.stat()
File "/opt/anaconda3/lib/python3.9/pathlib.py", line 1232, in stat
return self._accessor.stat(self)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/conf.json'
[E 13:35:28.143 NotebookApp] {
      "Host": "localhost:8888",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
      "Referer": "http://localhost:8888/tree/Downloads/Python%20files",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    }
[E 13:35:28.143 NotebookApp] 500 GET /notebooks/Downloads/Python%20files/Letovo_olympiad.ipynb (::1) 52.210000ms referer=http://localhost:8888/tree/Downloads/Python%20files

然后我制作了其他類型的文件(例如文本)並且它們已正常打開。 該問題僅發生在 Python 3 個文件中。

只需刪除並重新下載它,或者您可以檢查您的系統是否已授予訪問權限以進行更改或授予權限。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM