[IPython-dev] ipython0 and sys.displayhook

Laurent Dufrechou laurent.dufrechou@gmail....
Sun Aug 24 15:09:00 CDT 2008


Hello guys,

 

I've run into a weird bug in editra ipython plugin. When instanciating
ipython0 shell sys.displayhook was aletred by ipython and that interfered
with classical python shell plugin in editra.

I've quick workarounded it with saving sys.displayhook, then creating
ipython0 instance and finally restoring sys.displayhook.

The strange think is that ipython0 is still working. J

 

In shell.py it seems that you do the same trick I do with "class
IPShellEmbed"

While in iplib.py there is:

        # I don't like assigning globally to sys, because it means when

        # embedding instances, each embedded instance overrides the previous

        # choice. But sys.displayhook seems to be called internally by exec,

        # so I don't see a way around it.  We first save the original and
then

        # overwrite it.

        self.sys_displayhook = sys.displayhook

        sys.displayhook = self.outputcache

 

So why this displayhook is used for?

 

Laurent

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20080824/da125a5b/attachment.html 


More information about the IPython-dev mailing list