[IPython-dev] Custom sentinels

Ville M. Vainio vivainio@gmail....
Wed Feb 13 14:51:56 CST 2008

This is of interest to both leo-editor and ipython-dev, I think...

I'm trying to use @others to run many ipython scripts in child nodes.

However, there is a problem. _ip.runlines() expects "normal" IPython
input, which means all top-level blocks need to be terminated with 2
empty lines (for IPython to know they are to be executed). e.g.

if 1:
  print "hello"
<empty line>
<empty line>

How can I cause those 2 empty lines to appear between every collected
(tangled?) child node, when I'm using g.getscript()?

If that is not easily doable, I can hack it into _ip.runlines() as
well, i.e. have the whitespace handling in runlines() to be this:

- First, remove all empty lines
- Then, before every line with indent level 0 that is preceded by a
line with higher indent level, add 2 empty lines.

Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

More information about the IPython-dev mailing list