[IPython-dev] magics in blocks (was Wish list updated)

Fernando Perez Fernando.Perez at colorado.edu
Wed Apr 6 19:52:22 EDT 2005


Frédéric Mantegazza wrote:
> Le Mercredi 6 Avril 2005 13:13, Fernando Perez a écrit :
> 
> 
>>Please update CVS and give things a try.  Magics can now be used in
>>multiline statements (with or wihtout leading %, depending on your
>>%automagic settings). Furthermore, magic calls now honor the same
>>variable expansion mechanism which aliases and system calls use:
> 
> 
> :o)
> 
> 
>>Here's a trivial example:
>>
>>In [17]: for i in range(3):
>>    ....:     mkdir $i
>>    ....:     !touch $i/hello
>>    ....:     ls -l $i
>>    ....:
>>total 0
>>-rw-r--r--  1 fperez wavelet 0 Apr  6 05:10 hello
>>total 0
>>-rw-r--r--  1 fperez wavelet 0 Apr  6 05:10 hello
>>total 0
>>-rw-r--r--  1 fperez wavelet 0 Apr  6 05:10 hello
> 
> 
> But I can't make it work this way. It only works if I use ipmagic() 
> function...
> 
> Here is some examples of the problems without ipmagic(). Note examples 17 
> and 18. 'pr' is one of our magic. The behaviour is different than magic 
> 'cd': when a param follow 'pr', the error occurs just after I hit enter. 
> Without param, the error occurs after the blank line. 
> 
> I may have a bad config or so...
> 
> In [13]:cd
> /home/fma
> 
> In [14]:for i in xrange(3):
>    ....:    cd
>    ....:
> ---------------------------------------------------------------------------
> exceptions.NameError                      Traceback (most recent call last)

Please make sure that:

1. You _really_ are running from CVS.

2. In your ipythonrc file, you have

multi_line_specials 1


Without this, it won't work.


For me, the above gives:

In [1]: for i in xrange(3):
    ...:     cd
    ...:
/home/fperez
/home/fperez
/home/fperez


Double check those two things and let me know.

best,

f




More information about the IPython-dev mailing list