[IPython-dev] IPython and Eclipse

Fernando Perez Fernando.Perez at colorado.edu
Fri Jan 28 20:44:15 CST 2005


Hi Fabio,

this discussion is best had on the ipython-dev list, for various reasons: I 
don't have win32 experience, there are some Eclipse users there, and there's 
also a chance someone might pick it up and help via gmane.

I'm cc-ing the list in my reply, so I encourage you to subscribe (or use it 
via gmane).  It's very low traffic.  Having said  that...

Fabio Zadrozny wrote:
> Hy Fernando,
> 
> I'm trying to integrate IPython in the PyDev plugin (python eclipse plugin),
> but I'm having some problem understanding its behaviour (I must say I didn't
> look at its code yet).

This sounds great!  I know many people like eclipse very much, so this would 
be an excellent addition to ipython's bag of tricks.

[...]

> Now, trying a simple statement gives me an error
> 
> 
> ---------------------
> In [1]: a = []
> 
> In [2]: ------------------------------------------------------------
>    File "<console>", line 1
>      a = []
>            ^
> SyntaxError: invalid syntax
> ---------------------
> 
> 
> 
> But if I go for the help it works:
> ---------------------
> %magic

[...]

> Well, this is my first attempt to do it, so, I thought you might have some
> better ideas on why is this happening (I think it is because of the way the
> eclipse console treats things, but I also didn't give a better look at it
> because I think a better understanding on how ipython works would be
> essential to it).
> 
> Any ideas?

I don't really know, but something looks fishy about your example.  In 
particular, why is the exception printed on top of the next input line? 
Here's what a SyntaxError should look like:

In [1]: a b
------------------------------------------------------------
    File "<console>", line 1
      a b
        ^
SyntaxError: invalid syntax


In [2]:

That makes me wonder if Eclipse is mucking around with standard in/out, and 
perhaps putting funky characters at the end of the line?  Or maybe ipython's 
sources are doinng that, I honestly don't know.

I'm afraid this effort  may take a bit of digging under the hood on your part, 
though.  I'll be happy to help where I can, obviously.  You might want to 
stuff the ipython core input handling functions with print statements, getting 
the repr() of the input printed to see control chars.  Go into 
IPython/iplib.py, and look at the _prefilter() routine.  That's the input 
handler, you might want to play there a bit.  Most of the core ipython code is 
in iplib (be warned, it's quite messy).  Let me know if you get really 
confused, and I'll give you a hand.

Regards,

f




More information about the IPython-dev mailing list