Skip to content

Commit 3b75e03

Browse files
Tom Augspurgerjorisvandenbossche
Tom Augspurger
authored andcommitted
DOC: specify correct kernelspec for converting notebooks (#13491)
1 parent b01e07e commit 3b75e03

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

doc/make.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ def cleanup_nb(nb):
116116
pass
117117

118118

119+
def get_kernel():
120+
"""Find the kernel name for your python version"""
121+
return 'python%s' % sys.version_info.major
122+
123+
119124
def execute_nb(src, dst, allow_errors=False, timeout=1000, kernel_name=''):
120125
"""
121126
Execute notebook in `src` and write the output to `dst`
@@ -184,10 +189,12 @@ def html():
184189
with cleanup_nb(nb):
185190
try:
186191
print("Converting %s" % nb)
187-
executed = execute_nb(nb, nb + '.executed', allow_errors=True)
192+
kernel_name = get_kernel()
193+
executed = execute_nb(nb, nb + '.executed', allow_errors=True,
194+
kernel_name=kernel_name)
188195
convert_nb(executed, nb.rstrip('.ipynb') + '.html')
189-
except ImportError:
190-
pass
196+
except (ImportError, IndexError):
197+
print("Failed to convert %s" % nb)
191198

192199
if os.system('sphinx-build -P -b html -d build/doctrees '
193200
'source build/html'):
@@ -199,6 +206,7 @@ def html():
199206
except:
200207
pass
201208

209+
202210
def zip_html():
203211
try:
204212
print("\nZipping up HTML docs...")

0 commit comments

Comments
 (0)