[IPython-dev] strange namespace issue

Darren Dale dd55 at cornell.edu
Mon Sep 10 12:40:02 EDT 2007


While working on some blocking issues in IPShellQt* (almost done), I 
discovered some really funny behavior. I'm not ready to commit my code just 
yet, but the problem also exists for the gtk code, which I have not touched. 
I'm running a script from the matplotlib examples:

$ ipython -gthread
In [1]: run embedding_in_gtk
# Now close the plot window by clicking the X in the upper right hand corner 
of the frame

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/usr/local/src/matplotlib/matplotlib/examples/embedding_in_gtk2.py in 
<lambda>(x)
     21
     22 win = gtk.Window()
---> 23 win.connect("destroy", lambda x: gtk.main_quit())
     24 win.set_default_size(400,300)
     25 win.set_title("Embedding in GTK")

AttributeError: 'NoneType' object has no attribute 'main_quit'

Can anyone confirm this?

I get more errors with embedding_in_qt4, it seems like all the modules in the 
script have become NoneType. I can even print dir(QtCore) right before the 
line that produces the attribute error, which looks ok, but I still get the 
attribute error. I tried dropping back to mpl-0.90.1 and there was no change. 
I also tried removing setuptools, clearing my site-packages, reinstalling 
ipython and matplotlib, no improvement. I dont get the attribute errors if I 
run the scripts outside of ipython.

My only guess is that this has something to do with the way the  Shell.py 
overwrites certain module functions and classes like gtk.mainloop, or 
QtGui.QApplication, but I dont know.

Darren



More information about the IPython-dev mailing list