[IPython-dev] IPython issues in Sage

Mike Hansen mhansen at gmail.com
Mon Jul 14 15:30:11 EDT 2008


tHello,

I have two issues that I'd like to report to see if someone knows
what's going wrong since after looking at them for awhile, I'm stuck.

1) When Sage upgraded to IPython 0.8.2, the following trace command broke:

import pdb
import preprocessor
def trace(code, preparse=True):
    code = preparser.preparse(code)
    return pdb.runeval(code)

Before, it would have all the the global variables in the namespace
that code was being run in.  After the swtich to 0.8.2, none of the
globals where present.  I tried explicitly including ip.user_ns in the
environment, but only sort of worked:  see
http://trac.sagemath.org/sage_trac/ticket/3345


2) I tried updating Sage to use IPython 0.8.4, and code in
sage.misc.interpreter which refers to "_ip" now gives

NameError: global name '_ip' is not defined

Was this variable magically inserted into the namespace before?
Anyways, if I add

import IPython.ipapi
_ip = IPython.ipapi.get()

then I don't get the error about "_ip", but Sage quits without running
the mainloop after starting up.  This seems similar to what was
happening here: http://trac.sagemath.org/sage_trac/ticket/1264 .  I
tried clearing out all old IPython modules from site-packages and then
install 0.8.4 cleanly, but that didn't seem to help.

Thanks,
Mike



More information about the IPython-dev mailing list