问题
Has anybody come across this?
I've taken the GTK HelloWorld sample. It runs fine. However, if i import win32ui
, then it does not shutdown properly (as explained in this question ).
There are other problems. In the process of narrowing down my application to see what caused it to not shutdown, I came upon a point where I was deconstructing a logger class I had written that I had no problems with. In the constructor I had the line:
self.logger = logger
I had commented out the rest of the class so self.logger
was not even used. If I left the line as-is, I would get this error upon clicking the "Hello World" button:
c:\python26\lib\site-packages\twisted\internet\gtk2reactor.py:350: GtkWarning: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed
gtk.main()
If I change the line to:
self.logger = 0
then the error would not show up. This happened with various other lines of code in the logger class as well. I suspect it would happen with other random bits of code, too. But in any case - setting a variable that isn't even used should not cause any kind of problem. Note that at this point I was still using twisted with pygtk. I haven't reproduced this yet with just gtk.
This makes me suspect pygtk is being really unstable... has anybody come across this before? Is there anything I can do? The reason I updated from gtk 2.12
was because my application would crash randomly, but this is far worse.
UPDATE: The bugs happen on 64-bit Windows 7. I've tried both with 32-bit python with the versions listed above, and 64-bit python with pygtk-2.17.1, pygobject-2.21.2, pycairo-1.8.8 and pywin32-214.
So far the win32ui
bug does not happen with the same install on a Windows XP VirtualBox virtual machine.
回答1:
I've tried this on a different install of Win7 64-bit on a different computer, and it worked fine. So it's some strange thing with the hardware/other software on a particular computer. Probably nothing gtk or win32 related.
来源:https://stackoverflow.com/questions/4326710/serious-instability-with-pygtk-2-22-and-python-2-6