Skip to content

Commit

Permalink
Merge pull request #102 from davidbrochart/kernel_info
Browse files Browse the repository at this point in the history
Move language_info retrieval before cell execution
  • Loading branch information
davidbrochart committed Aug 26, 2020
2 parents ab760d6 + 0d2dbeb commit 1431476
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nbclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,6 @@ async def async_execute(
async with self.async_setup_kernel(**kwargs):
assert self.kc is not None
self.log.info("Executing notebook with kernel: %s" % self.kernel_name)
for index, cell in enumerate(self.nb.cells):
# Ignore `'execution_count' in content` as it's always 1
# when store_history is False
await self.async_execute_cell(
cell, index, execution_count=self.code_cells_executed + 1
)
msg_id = await ensure_async(self.kc.kernel_info())
info_msg = await self.async_wait_for_reply(msg_id)
if info_msg is not None:
Expand All @@ -535,6 +529,12 @@ async def async_execute(
'Kernel info received message content has no "language_info" key.'
'Content is:\n' + str(info_msg['content'])
)
for index, cell in enumerate(self.nb.cells):
# Ignore `'execution_count' in content` as it's always 1
# when store_history is False
await self.async_execute_cell(
cell, index, execution_count=self.code_cells_executed + 1
)
self.set_widgets_metadata()

return self.nb
Expand Down

0 comments on commit 1431476

Please sign in to comment.