[python-win32] OLE Server Busy dialog box

Mark Hammond mhammond at skippinet.com.au
Wed Aug 2 14:12:14 CEST 2006

> I've been trying to solve a small but disturbing problem with
> win32com, but I can't.
> It's the "OLE Server Busy" problem [1]:
> "If you call a method on a COM server from an MFC COM client
> application and if the method takes a long time to process and return
> back, you won't be able to do anything on the client application and
> the OLE Server Busy dialog box pops up..."

Unless you are using the win32ui module, its unlikely you qualify as an "MFC
COM client".

> The link explains how to solve it. But it's not that straight forward
> in python. They suggest using Afx* functions.

It also casually mentions at the bottom:

| Another way to suppress the server busy dialog box is to use
| OleInitialize and OleUninitialize instead of AfxOleInit in your
| application.

which are easy to call.

> on a DLL and then calling them from python using pyrex. But it didn't
> work out. The functions are called, but the program crashes when
> trying to access a member of the Filter. And adding a DLL only makes
> it more complex.

Yeah - things aren't going to work that well if MFC isn't correctly

> There should be a simple-clean way to do that.
> Anyone had this problem before? Anyone figured out a way to fix it?

Try and ensure your threads are all initialized for free-threading (setting
sys.coinit_flags=0 before importing win32com/pythoncom will ensure that is
true for the main thread), and that all threads are running message loops.


More information about the Python-win32 mailing list