[IPython-dev] Strange bug

Fernando Perez fperez.net@gmail....
Thu Mar 22 01:42:21 CDT 2007


Hi Greg,

On 1/5/07, Gregory Novak <novak@ucolick.org> wrote:
> I just spent the better part of a day trying to figure out what on
> earth was going on with a rather strange bug.  The dramatis personae:
>
> pyIDL is a bit of python + c code that allows you call IDL
> (http://www.ittvis.com/idl/) code from Python
> (http://www.its.caltech.edu/~mmckerns/software.html)
>
> (for Mike: IPython is an enhanced interactive python shell
> http://ipython.scipy.org/moin/)
>
> pyIDL provides getattr/setattr functions to access variables in IDL so
> that instead of typing idl_instance.get('x') you can type
> idl_instance.x
>
> There's also a function called eval that evaluates IDL expressions,
> like so:
> idl_instance.eval('y=x')
>
> When I called idl_instance.eval('y=x') under plain vanilla python, it
> worked fine.  When I called the same thing under IPython, I got
> strange errors coming from IDL:
>
> % Attempt to call undefined procedure/function: 'EVAL'.
> % Execution halted at: $MAIN$

[...]

I just wanted to update you on this.  I'm pretty sure that recent work
on the input parsinng code, with contributions from Dan Milstein and
Alex Schmolck, have squashed this particular bug (Alex got hit
basically by the same problem, and in an oddly similar system: his
matlab call system which is much like your IDL one but for matlab).

Here's a simple demo:

In [3]: !cat attribs.py
class foo(object):
       def __getattr__(self,attr):
           print 'getattr: ', attr; return lambda *args, **kwargs: 'nada'

f=foo()
f.bar()

In [4]: run attribs.py
getattr:  bar

In [5]: f.eval('y=x')
getattr:  eval
Out[5]: 'nada'


So I think that with current SVN, or ipython 0.7.4 (due in a couple of
weeks) you should be good.  It would be nice if you could double check
with an SVN checkout and let us know of any problems before  we put
0.7.4 officially out.

Cheers,

f


More information about the IPython-dev mailing list