[IPython-dev] strange namespace issue
Mon Sep 10 13:19:42 CDT 2007
On Monday 10 September 2007 01:23:51 pm Fernando Perez wrote:
> On 9/10/07, Darren Dale <firstname.lastname@example.org> wrote:
> > 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.
> I certainly see the problem here, but I have no idea of what it can be
> or a solution. To be honest, I'd always thought that the embedding*
> examples were a bit more than ipython could handle. Granted, the fact
> that one can run something as complicated as the new mayavi2 windows
> from within ipython indicates that it must be possible, but when we
> wrote all that code, the real target was just cooperation with pylab.
> Once we got that working we kind of stopped looking, and that means we
> may well have left important ends untied.
Just to be thorough, I'll note that the problem also exists for some of the
regular pylab scripts as well: dynamic_collection.py, animation_blit_qt4. I
found a post that might be relevant:
"Python's reload() [...] twiddles the old functions and methods
in such a way that all old globals are set to None. If you have the
misfortune of calling an old function or method, it's likely to fail"
I can't spend any more time on this now. If I knew how to solve this problem,
we could run pyqt* programs in ipython, they would be non-blocking, and it
would be possible to inspect the application state. Instead, I'm leaving it
so the programs do block, this way they run without errors.
More information about the IPython-dev