Show More
@@ -6,7 +6,7 Requires Python 2.1 or better. | |||||
6 |
|
6 | |||
7 | This file contains the main make_IPython() starter function. |
|
7 | This file contains the main make_IPython() starter function. | |
8 |
|
8 | |||
9 |
$Id: ipmaker.py 10 |
|
9 | $Id: ipmaker.py 1086 2006-01-27 16:02:38Z vivainio $""" | |
10 |
|
10 | |||
11 | #***************************************************************************** |
|
11 | #***************************************************************************** | |
12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
|
12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> | |
@@ -661,16 +661,19 object? -> Details about 'object'. ?object also works, ?? prints more. | |||||
661 | if not embedded and IP_rc.args: |
|
661 | if not embedded and IP_rc.args: | |
662 | name_save = IP.user_ns['__name__'] |
|
662 | name_save = IP.user_ns['__name__'] | |
663 | IP.user_ns['__name__'] = '__main__' |
|
663 | IP.user_ns['__name__'] = '__main__' | |
664 | try: |
|
|||
665 |
|
|
664 | # Set our own excepthook in case the user code tries to call it | |
666 |
|
|
665 | # directly. This prevents triggering the IPython crash handler. | |
667 |
|
|
666 | old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook | |
668 | for run in args: |
|
667 | ||
669 | IP.safe_execfile(run,IP.user_ns) |
|
668 | save_argv = sys.argv[:] # save it for later restoring | |
|
669 | sys.argv.pop(0) # the first arg is 'ipython' | |||
|
670 | ||||
|
671 | try: | |||
|
672 | IP.safe_execfile(args[0], IP.user_ns) | |||
670 | finally: |
|
673 | finally: | |
671 | # Reset our crash handler in place |
|
674 | # Reset our crash handler in place | |
672 | sys.excepthook = old_excepthook |
|
675 | sys.excepthook = old_excepthook | |
673 |
|
676 | sys.argv = save_argv | ||
674 | IP.user_ns['__name__'] = name_save |
|
677 | IP.user_ns['__name__'] = name_save | |
675 |
|
678 | |||
676 | msg.user_exec.release_all() |
|
679 | msg.user_exec.release_all() |
@@ -1,3 +1,10 | |||||
|
1 | 2006-01-27 Ville Vainio <vivainio@gmail.com> | |||
|
2 | ||||
|
3 | * ipmaker.py: Give "realistic" sys.argv for scripts (without | |||
|
4 | 'ipython' at argv[0]) executed through command line. | |||
|
5 | NOTE: this DEPRECATES calling ipython with multiple scripts | |||
|
6 | ("ipython a.py b.py c.py") | |||
|
7 | ||||
1 | 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu> |
|
8 | 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu> | |
2 |
|
9 | |||
3 | * IPython/demo.py (Demo.show): Flush stdout after each block, so |
|
10 | * IPython/demo.py (Demo.show): Flush stdout after each block, so |
General Comments 0
You need to be logged in to leave comments.
Login now