##// END OF EJS Templates
"ipython mybatch.ipy" now runs mybatch.ipy w/ _ip.runlines(), ...
vivainio -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 1232 2006-04-01 10:59:41Z vivainio $
9 $Id: iplib.py 1260 2006-04-11 10:19:34Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -665,6 +665,12 b' class InteractiveShell(object,Magic):'
665 self.magic_alias(alias)
665 self.magic_alias(alias)
666 self.hooks.late_startup_hook()
666 self.hooks.late_startup_hook()
667
667
668 for batchfile in [path(arg) for arg in self.rc.args
669 if arg.lower().endswith('.ipy')]:
670 if not batchfile.isfile():
671 print "No such batch file:", batchfile
672 continue
673 self.api.runlines(batchfile.text())
668
674
669 def add_builtins(self):
675 def add_builtins(self):
670 """Store ipython references into the builtin namespace.
676 """Store ipython references into the builtin namespace.
@@ -6,7 +6,7 b' 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 1225 2006-03-28 09:11:52Z vivainio $"""
9 $Id: ipmaker.py 1260 2006-04-11 10:19:34Z 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>
@@ -608,6 +608,9 b" object? -> Details about 'object'. ?object also works, ?? prints more."
608 except ImportError:
608 except ImportError:
609 if opts_all.debug: IP.InteractiveTB()
609 if opts_all.debug: IP.InteractiveTB()
610 warn("Could not import 'ipy_system_conf'")
610 warn("Could not import 'ipy_system_conf'")
611 except:
612 IP.InteractiveTB()
613 import_fail_info('ipy_system_conf')
611
614
612 if opts_all.profile:
615 if opts_all.profile:
613 profmodname = 'ipy_profile_' + opts_all.profile
616 profmodname = 'ipy_profile_' + opts_all.profile
@@ -623,6 +626,7 b" object? -> Details about 'object'. ?object also works, ?? prints more."
623 except:
626 except:
624 print "Error importing",profmodname
627 print "Error importing",profmodname
625 IP.InteractiveTB()
628 IP.InteractiveTB()
629 import_fail_info(profmodname)
626
630
627 try:
631 try:
628 import ipy_user_conf
632 import ipy_user_conf
@@ -633,6 +637,7 b" object? -> Details about 'object'. ?object also works, ?? prints more."
633 except:
637 except:
634 print "Error importing ipy_user_conf"
638 print "Error importing ipy_user_conf"
635 IP.InteractiveTB()
639 IP.InteractiveTB()
640 import_fail_info("ipy_user_conf")
636
641
637
642
638 # release stdout and stderr and save config log into a global summary
643 # release stdout and stderr and save config log into a global summary
@@ -682,7 +687,8 b" object? -> Details about 'object'. ?object also works, ?? prints more."
682 # ipython prompt. This would also give them the benefit of ipython's
687 # ipython prompt. This would also give them the benefit of ipython's
683 # nice tracebacks.
688 # nice tracebacks.
684
689
685 if not embedded and IP_rc.args:
690 if (not embedded and IP_rc.args and
691 not IP_rc.args[0].lower().endswith('.ipy')):
686 name_save = IP.user_ns['__name__']
692 name_save = IP.user_ns['__name__']
687 IP.user_ns['__name__'] = '__main__'
693 IP.user_ns['__name__'] = '__main__'
688 # Set our own excepthook in case the user code tries to call it
694 # Set our own excepthook in case the user code tries to call it
@@ -1,3 +1,9 b''
1 2006-04-11 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
4 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
5 prefilters, allowing stuff like magics and aliases in the file.
6
1 2006-03-28 Ville Vainio <vivainio@gmail.com>
7 2006-03-28 Ville Vainio <vivainio@gmail.com>
2
8
3 * iplib.py: Fix quoting of aliases so that only argless ones
9 * iplib.py: Fix quoting of aliases so that only argless ones
General Comments 0
You need to be logged in to leave comments. Login now