Show More
@@ -28,6 +28,7 b' from IPython.core.oinspect import find_file, find_source_lines' | |||||
28 | from IPython.testing.skipdoctest import skip_doctest |
|
28 | from IPython.testing.skipdoctest import skip_doctest | |
29 | from IPython.utils import openpy |
|
29 | from IPython.utils import openpy | |
30 | from IPython.utils import py3compat |
|
30 | from IPython.utils import py3compat | |
|
31 | from IPython.utils.contexts import preserve_keys | |||
31 | from IPython.utils.io import file_read |
|
32 | from IPython.utils.io import file_read | |
32 | from IPython.utils.path import get_py_filename, unquote_filename |
|
33 | from IPython.utils.path import get_py_filename, unquote_filename | |
33 | from IPython.utils.warn import warn |
|
34 | from IPython.utils.warn import warn | |
@@ -513,12 +514,15 b' class CodeMagics(Magics):' | |||||
513 |
|
514 | |||
514 | else: |
|
515 | else: | |
515 | print 'done. Executing edited code...' |
|
516 | print 'done. Executing edited code...' | |
516 | if 'r' in opts: # Untranslated IPython code |
|
517 | with preserve_keys(self.shell.user_ns, '__file__'): | |
517 | self.shell.run_cell(file_read(filename), |
|
518 | if not is_temp: | |
518 | store_history=False) |
|
519 | self.shell.user_ns['__file__'] = filename | |
519 | else: |
|
520 | if 'r' in opts: # Untranslated IPython code | |
520 |
self.shell. |
|
521 | self.shell.run_cell(file_read(filename), | |
521 |
|
|
522 | store_history=False) | |
|
523 | else: | |||
|
524 | self.shell.safe_execfile(filename, self.shell.user_ns, | |||
|
525 | self.shell.user_ns) | |||
522 |
|
526 | |||
523 | if is_temp: |
|
527 | if is_temp: | |
524 | try: |
|
528 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now