[IPython-dev] IPython.ipapi stopped working

Brian Granger ellisonbg.net@gmail....
Wed Oct 14 14:06:27 CDT 2009


Ondrej,

Yes, as Robert said, trunk is in a semi-unstable state right now.  Most
things do work, but
the APIs have changed.  I can help you update the sympy things to the new
APIs, but it is
probably a little early.

Other than isympy, in what other ways does sympy use IPython?

I can help you update the things in sympy.

I have already created a sympy profile for ipython that does what isympy
does:

http://bazaar.launchpad.net/~ipython-dev/ipython/trunk/annotate/head%3A/IPython/config/profile/ipython_config_sympy.py

Also, I have implemented the top-level embed function you requested.  If you
don't mind going
back to the latest release, I will try to get sympy working with the new
stuff.

Cheers,

Brian

On Wed, Oct 14, 2009 at 11:26 AM, Ondrej Certik <ondrej@certik.cz> wrote:

> Hi,
>
> with the latest ipython bzr trunk:
>
> $ bin/doctest
> ============================= test process starts
> ==============================
> executable:   /usr/bin/python  (2.6.2-final-0)
>
> Traceback (most recent call last):
>  File "bin/doctest", line 30, in <module>
>    "blacklist": blacklist})
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line
> 140, in doctest
>    dtest = t.test()
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line 368, in
> test
>    self.test_file(f)
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line
> 382, in test_file
>    setup_pprint()
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line
> 48, in setup_pprint
>    init_printing(sstrrepr)
>  File "/home/ondrej/repos/sympy/sympy/interactive/__init__.py", line
> 14, in init_printing
>    ip = IPython.ipapi.get()
> AttributeError: 'module' object has no attribute 'ipapi'
>
>
> That happens because there is no "ipapi" in IPython:
>
> In [1]: import IPython.ipapi
> ------------------------------------------------------------
> Traceback (most recent call last):
>  File "<ipython console>", line 1, in <module>
> ImportError: No module named ipapi
>
>
> A quick experimentation shows that this could work:
>
> In [1]: import IPython.core.ipapi
>
> In [2]:
>
> So applying this patch:
>
> $ git diff
> diff --git a/sympy/interactive/__init__.py b/sympy/interactive/__init__.py
> index 5e253b8..d0cc9fe 100644
> --- a/sympy/interactive/__init__.py
> +++ b/sympy/interactive/__init__.py
> @@ -11,7 +11,7 @@ def init_printing(stringify_func):
>     try:
>         import IPython
>
> -        ip = IPython.ipapi.get()
> +        ip = IPython.core.ipapi.get()
>
>         if ip is not None:
>             def result_display(self, arg):
>
>
> moves us a bit further, but not enough:
>
>
> $ bin/doctest
> ============================= test process starts
> ==============================
> executable:   /usr/bin/python  (2.6.2-final-0)
>
> Traceback (most recent call last):
>  File "bin/doctest", line 30, in <module>
>    "blacklist": blacklist})
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line
> 140, in doctest
>    dtest = t.test()
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line 368, in
> test
>    self.test_file(f)
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line
> 382, in test_file
>    setup_pprint()
>  File "/home/ondrej/repos/sympy/sympy/utilities/runtests.py", line
> 48, in setup_pprint
>    init_printing(sstrrepr)
>  File "/home/ondrej/repos/sympy/sympy/interactive/__init__.py", line
> 14, in init_printing
>    ip = IPython.core.ipapi.get()
>  File "/home/ondrej/usr/lib/python/IPython/core/ipapi.py", line 31, in get
>    most_recent = insts[0]
> IndexError: list index out of range
>
>
>
>
> Any ideas how to fix this? I can't run doctests anymore due to this
> bug, unless I install old ipython again...
>
> Ondrej
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20091014/ca346c42/attachment.html 


More information about the IPython-dev mailing list