##// END OF EJS Templates
Let nbformat take care of opening the file...
Thomas Kluyver -
Show More
@@ -2501,13 +2501,12 b' class InteractiveShell(SingletonConfigurable):'
2501 2501 """generator for sequence of code blocks to run"""
2502 2502 if fname.endswith('.ipynb'):
2503 2503 from nbformat import read
2504 with io_open(fname) as f:
2505 nb = read(f, as_version=4)
2506 if not nb.cells:
2507 return
2508 for cell in nb.cells:
2509 if cell.cell_type == 'code':
2510 yield cell.source
2504 nb = read(fname, as_version=4)
2505 if not nb.cells:
2506 return
2507 for cell in nb.cells:
2508 if cell.cell_type == 'code':
2509 yield cell.source
2511 2510 else:
2512 2511 with open(fname) as f:
2513 2512 yield f.read()
General Comments 0
You need to be logged in to leave comments. Login now