##// END OF EJS Templates
Backport PR #10558: Let nbformat take care of opening the file...
Matthias Bussonnier -
Show More
@@ -2535,13 +2535,12 b' class InteractiveShell(SingletonConfigurable):'
2535 2535 """generator for sequence of code blocks to run"""
2536 2536 if fname.endswith('.ipynb'):
2537 2537 from nbformat import read
2538 with io_open(fname) as f:
2539 nb = read(f, as_version=4)
2540 if not nb.cells:
2541 return
2542 for cell in nb.cells:
2543 if cell.cell_type == 'code':
2544 yield cell.source
2538 nb = read(fname, as_version=4)
2539 if not nb.cells:
2540 return
2541 for cell in nb.cells:
2542 if cell.cell_type == 'code':
2543 yield cell.source
2545 2544 else:
2546 2545 with open(fname) as f:
2547 2546 yield f.read()
General Comments 0
You need to be logged in to leave comments. Login now