Show More
@@ -29,6 +29,7 b' from IPython.core.oinspect import find_file, find_source_lines' | |||||
29 | from IPython.testing.skipdoctest import skip_doctest |
|
29 | from IPython.testing.skipdoctest import skip_doctest | |
30 | from IPython.utils import openpy |
|
30 | from IPython.utils import openpy | |
31 | from IPython.utils import py3compat |
|
31 | from IPython.utils import py3compat | |
|
32 | from IPython.utils.contexts import preserve_keys | |||
32 | from IPython.utils.io import file_read |
|
33 | from IPython.utils.io import file_read | |
33 | from IPython.utils.path import get_py_filename, unquote_filename |
|
34 | from IPython.utils.path import get_py_filename, unquote_filename | |
34 | from IPython.utils.warn import warn |
|
35 | from IPython.utils.warn import warn | |
@@ -536,12 +537,15 b' class CodeMagics(Magics):' | |||||
536 |
|
537 | |||
537 | else: |
|
538 | else: | |
538 | print 'done. Executing edited code...' |
|
539 | print 'done. Executing edited code...' | |
539 | if 'r' in opts: # Untranslated IPython code |
|
540 | with preserve_keys(self.shell.user_ns, '__file__'): | |
540 | self.shell.run_cell(file_read(filename), |
|
541 | if not is_temp: | |
541 | store_history=False) |
|
542 | self.shell.user_ns['__file__'] = filename | |
542 | else: |
|
543 | if 'r' in opts: # Untranslated IPython code | |
543 |
self.shell. |
|
544 | self.shell.run_cell(file_read(filename), | |
544 |
|
|
545 | store_history=False) | |
|
546 | else: | |||
|
547 | self.shell.safe_execfile(filename, self.shell.user_ns, | |||
|
548 | self.shell.user_ns) | |||
545 |
|
549 | |||
546 | if is_temp: |
|
550 | if is_temp: | |
547 | try: |
|
551 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now