Skip to content

Commit

Permalink
Failsafe on kernelspec errors #120
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Nov 12, 2018
1 parent 203abe7 commit a15b126
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jupytext/contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@

def kernelspec_from_language(language):
"""Return the kernel specification for the first kernel with a matching language"""
for name in find_kernel_specs():
ks = get_kernel_spec(name)
if ks.language == language:
return {'name': name, 'language': language, 'display_name': ks.display_name}
try:
for name in find_kernel_specs():
ks = get_kernel_spec(name)
if ks.language == language:
return {'name': name, 'language': language, 'display_name': ks.display_name}
except KeyError:
pass
return None


Expand Down

0 comments on commit a15b126

Please sign in to comment.