Show More
@@ -277,20 +277,17 b' class InteractiveShellApp(Configurable):' | |||
|
277 | 277 | sys.argv = [ py3compat.cast_bytes(a) for a in sys.argv ] |
|
278 | 278 | try: |
|
279 | 279 | if os.path.isfile(full_filename): |
|
280 | if full_filename.endswith('.ipy'): | |
|
281 | self.log.info("Running file in user namespace: %s" % | |
|
282 | full_filename) | |
|
283 | self.shell.safe_execfile_ipy(full_filename) | |
|
284 | else: | |
|
285 | # default to python, even without extension | |
|
286 | self.log.info("Running file in user namespace: %s" % | |
|
287 | full_filename) | |
|
288 | # Ensure that __file__ is always defined to match Python behavior | |
|
289 | self.shell.user_ns['__file__'] = fname | |
|
290 | try: | |
|
280 | self.log.info("Running file in user namespace: %s" % full_filename) | |
|
281 | # Ensure that __file__ is always defined to match Python behavior | |
|
282 | self.shell.user_ns['__file__'] = fname | |
|
283 | try: | |
|
284 | if full_filename.endswith('.ipy'): | |
|
285 | self.shell.safe_execfile_ipy(full_filename) | |
|
286 | else: | |
|
287 | # default to python, even without extension | |
|
291 | 288 | self.shell.safe_execfile(full_filename, self.shell.user_ns) |
|
292 |
|
|
|
293 |
|
|
|
289 | finally: | |
|
290 | del self.shell.user_ns['__file__'] | |
|
294 | 291 | finally: |
|
295 | 292 | sys.argv = save_argv |
|
296 | 293 |
General Comments 0
You need to be logged in to leave comments.
Login now