##// END OF EJS Templates
Merge pull request #10558 from takluyver/read-nb-utf8...
Matthias Bussonnier -
r23652:d936dda9 merge
parent child Browse files
Show More
@@ -2506,13 +2506,12 b' class InteractiveShell(SingletonConfigurable):'
2506 """generator for sequence of code blocks to run"""
2506 """generator for sequence of code blocks to run"""
2507 if fname.endswith('.ipynb'):
2507 if fname.endswith('.ipynb'):
2508 from nbformat import read
2508 from nbformat import read
2509 with io_open(fname) as f:
2509 nb = read(fname, as_version=4)
2510 nb = read(f, as_version=4)
2510 if not nb.cells:
2511 if not nb.cells:
2511 return
2512 return
2512 for cell in nb.cells:
2513 for cell in nb.cells:
2513 if cell.cell_type == 'code':
2514 if cell.cell_type == 'code':
2514 yield cell.source
2515 yield cell.source
2516 else:
2515 else:
2517 with open(fname) as f:
2516 with open(fname) as f:
2518 yield f.read()
2517 yield f.read()
General Comments 0
You need to be logged in to leave comments. Login now