Importing win32ui in a simple .py program causes a hang on exit with pywin32-218.
This hang occurs under Python 2.6.7, 2.7.4, and 3.1.4. It does not occur under 3.2.4 and 3.3.1. I currently only test using 32-bit Python.
The last-known good pywin32 version on Py2.6 was pywin32-212. Some regression was introduced in pywin32-213 and has existed since then (still in pywin32-218), causing this system hang on exit on Python builds 2.6 and 2.7. Testing Python 3, I see that the issue exists in Pythons 3.0 and 3.1 but goes away in 3.2 and 3.3.
The following Python code
snippet demonstrates a hang on exit:
#################################
import Tkinter
import win32ui #including this library causes hang on exit
master = Tkinter.Tk()
#Label not needed to reproduce hang
Tkinter.Label(text=" Will hang on exit if win32ui has been imported").pack()
master.mainloop()
#################################
This bug is preventing me from upgrading my build to Python 2.7, because:
1) I need pywin32,
2) pywin32-212 is the last version that does not have the hang regression, and
3) pywin32-212 Windows builds stop at Python 2.6.
Simple Python program and script files to run it under different Python builds
I should mention that I only have tested running 32-bit Python on 64-bit Windows 7.
Sadly Tkinter and win32ui have played poorly together, in various ways, basically forever. This is just the nature of the beast when multiple things want to control the main event loop. I've no intention of trying to fix this, but would accept patches that make things suck less then they currently do.
Maybe the reason for the crash is the same as for the bug I reported here: https://sourceforge.net/p/pywin32/bugs/675/
There's also a bugfix included. Maybe your problem goes away with this fix, too.