Show More
@@ -2664,7 +2664,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2664 | 2664 | # tb offset is 2 because we wrap execfile |
|
2665 | 2665 | self.showtraceback(tb_offset=2) |
|
2666 | 2666 | |
|
2667 | def safe_execfile_ipy(self, fname, shell_futures=False): | |
|
2667 | def safe_execfile_ipy(self, fname, raise_exceptions=False, shell_futures=False): | |
|
2668 | 2668 | """Like safe_execfile, but for .ipy or .ipynb files with IPython syntax. |
|
2669 | 2669 | |
|
2670 | 2670 | Parameters |
@@ -2672,6 +2672,8 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2672 | 2672 | fname : str |
|
2673 | 2673 | The name of the file to execute. The filename must have a |
|
2674 | 2674 | .ipy or .ipynb extension. |
|
2675 | raise_exceptions : bool (False) | |
|
2676 | If True raise exceptions everywhere. Meant for testing. | |
|
2675 | 2677 | shell_futures : bool (False) |
|
2676 | 2678 | If True, the code will share future statements with the interactive |
|
2677 | 2679 | shell. It will both be affected by previous __future__ imports, and |
@@ -2711,12 +2713,13 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2711 | 2713 | with prepended_to_syspath(dname): |
|
2712 | 2714 | try: |
|
2713 | 2715 | for cell in get_cells(): |
|
2714 | # self.run_cell currently captures all exceptions | |
|
2715 | # raised in user code. It would be nice if there were | |
|
2716 | # versions of run_cell that did raise, so | |
|
2717 | # we could catch the errors. | |
|
2718 | 2716 | result = self.run_cell(cell, silent=True, shell_futures=shell_futures) |
|
2719 | if not result.success: | |
|
2717 | if not result.success and raise_exceptions: | |
|
2718 | if result.error_before_exec is not None: | |
|
2719 | raise result.error_before_exec | |
|
2720 | else: | |
|
2721 | raise result.error_in_exec | |
|
2722 | elif not result.success: | |
|
2720 | 2723 | break |
|
2721 | 2724 | except: |
|
2722 | 2725 | self.showtraceback() |
General Comments 0
You need to be logged in to leave comments.
Login now