Skip to content

Commit

Permalink
ExecutePreprocessor: Get kernel name when executing
Browse files Browse the repository at this point in the history
... and not during initialization.

Fixes jupyter#878.
  • Loading branch information
mgeier committed Dec 4, 2018
1 parent eb3b0a7 commit d90026f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions nbconvert/preprocessors/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,6 @@ class ExecutePreprocessor(Preprocessor):
)
).tag(config=True)

@default('kernel_name')
def _kernel_name_default(self):
try:
return self.nb.metadata.get('kernelspec', {}).get('name', 'python')
except AttributeError:
raise AttributeError('You did not specify a kernel_name for '
'the ExecutePreprocessor and you have not set '
'self.nb to be able to use that to infer the '
'kernel_name.')

raise_on_iopub_timeout = Bool(False,
help=dedent(
"""
Expand Down Expand Up @@ -248,6 +238,8 @@ def start_new_kernel(self, **kwargs):
kc : KernelClient
Kernel client as created by the kernel manager `km`.
"""
self.kernel_name = self.nb.metadata.get('kernelspec', {}).get('name',
'python')
km = self.kernel_manager_class(kernel_name=self.kernel_name,
config=self.config)
km.start_kernel(extra_arguments=self.extra_arguments, **kwargs)
Expand Down

0 comments on commit d90026f

Please sign in to comment.