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 135 |
|
9 | $Id: iplib.py 1357 2006-06-08 12:15:46Z vivainio $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
@@ -666,12 +666,16 b' class InteractiveShell(object,Magic):' | |||||
666 | self.magic_alias(alias) |
|
666 | self.magic_alias(alias) | |
667 | self.hooks.late_startup_hook() |
|
667 | self.hooks.late_startup_hook() | |
668 |
|
668 | |||
|
669 | batchrun = False | |||
669 | for batchfile in [path(arg) for arg in self.rc.args |
|
670 | for batchfile in [path(arg) for arg in self.rc.args | |
670 | if arg.lower().endswith('.ipy')]: |
|
671 | if arg.lower().endswith('.ipy')]: | |
671 | if not batchfile.isfile(): |
|
672 | if not batchfile.isfile(): | |
672 | print "No such batch file:", batchfile |
|
673 | print "No such batch file:", batchfile | |
673 | continue |
|
674 | continue | |
674 | self.api.runlines(batchfile.text()) |
|
675 | self.api.runlines(batchfile.text()) | |
|
676 | batchrun = True | |||
|
677 | if batchrun: | |||
|
678 | self.exit_now = True | |||
675 |
|
679 | |||
676 | def add_builtins(self): |
|
680 | def add_builtins(self): | |
677 | """Store ipython references into the builtin namespace. |
|
681 | """Store ipython references into the builtin namespace. | |
@@ -1470,6 +1474,10 b' want to merge them back into the new files.""" % locals()' | |||||
1470 | close!). |
|
1474 | close!). | |
1471 |
|
1475 | |||
1472 | """ |
|
1476 | """ | |
|
1477 | ||||
|
1478 | if self.exit_now: | |||
|
1479 | # batch run -> do not interact | |||
|
1480 | return | |||
1473 | cprt = 'Type "copyright", "credits" or "license" for more information.' |
|
1481 | cprt = 'Type "copyright", "credits" or "license" for more information.' | |
1474 | if banner is None: |
|
1482 | if banner is None: | |
1475 | self.write("Python %s on %s\n%s\n(%s)\n" % |
|
1483 | self.write("Python %s on %s\n%s\n(%s)\n" % | |
@@ -1484,7 +1492,6 b' want to merge them back into the new files.""" % locals()' | |||||
1484 | __builtin__.__dict__['__IPYTHON__active'] += 1 |
|
1492 | __builtin__.__dict__['__IPYTHON__active'] += 1 | |
1485 |
|
1493 | |||
1486 | # exit_now is set by a call to %Exit or %Quit |
|
1494 | # exit_now is set by a call to %Exit or %Quit | |
1487 | self.exit_now = False |
|
|||
1488 | while not self.exit_now: |
|
1495 | while not self.exit_now: | |
1489 | if more: |
|
1496 | if more: | |
1490 | prompt = self.outputcache.prompt2 |
|
1497 | prompt = self.outputcache.prompt2 |
@@ -1,3 +1,8 b'' | |||||
|
1 | 2006-06-07 Ville Vainio <vivainio@gmail.com> | |||
|
2 | ||||
|
3 | * iplib.py: ipython mybatch.ipy exits ipython immediately after | |||
|
4 | running the batch files instead of leaving the session open. | |||
|
5 | ||||
1 | 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu> |
|
6 | 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu> | |
2 |
|
7 | |||
3 | * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as |
|
8 | * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as |
General Comments 0
You need to be logged in to leave comments.
Login now