Skip to content

Commit 0ee3a34

Browse files
committed
Fix nbconvert handler run_sync()
1 parent 923a828 commit 0ee3a34

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

jupyter_server/nbconvert/handlers.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ async def get(self, format, path):
118118

119119
# Exporting can take a while, delegate to a thread so we don't block the event loop
120120
try:
121-
output, resources = await run_sync(
122-
exporter.from_notebook_node(nb, resources=resource_dict)
123-
)
121+
output, resources = await run_sync(exporter.from_notebook_node, nb, resource_dict)
124122
except Exception as e:
125123
self.log.exception("nbconvert failed: %s", e)
126124
raise web.HTTPError(500, "nbconvert failed: %s" % e) from e
@@ -146,20 +144,19 @@ class NbconvertPostHandler(JupyterHandler):
146144
SUPPORTED_METHODS = ("POST",)
147145

148146
@web.authenticated
149-
def post(self, format):
147+
async def post(self, format):
150148
exporter = get_exporter(format, config=self.config)
151149

152150
model = self.get_json_body()
153151
name = model.get("name", "notebook.ipynb")
154152
nbnode = from_dict(model["content"])
155153

156154
try:
157-
output, resources = exporter.from_notebook_node(
155+
output, resources = await run_sync(
156+
exporter.from_notebook_node,
158157
nbnode,
159-
resources={
160-
"metadata": {
161-
"name": name[: name.rfind(".")],
162-
},
158+
{
159+
"metadata": {"name": name[: name.rfind(".")]},
163160
"config_dir": self.application.settings["config_dir"],
164161
},
165162
)

0 commit comments

Comments
 (0)