[python-win32] win32com: ServerBusy message
Mark Hammond
mhammond at skippinet.com.au
Wed Jan 30 02:03:25 CET 2008
If by "command-line window" you mean the interactive prompt in pythonwin,
IDLE or any other GUI environment, the problem will likely be the lack of a
"message pump" (google for that, particularly on this list). Although if
"command-line window" means running python.exe from a command-prompt and
entering the commands there, I've no idea why it would work interactively
but fail when run by python.exe as a script.
Hope this helps,
Mark
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org] On Behalf Of mauro tizianel
Sent: Wednesday, 30 January 2008 4:09 AM
To: python-win32 at python.org
Subject: [python-win32] win32com: ServerBusy message
Hi list,
I am calling a method on a COM server within a python script. The method
takes a long time to return ( > 15s) and I am getting a "Server Busy" popup
message "This action cannot be completed because the program is busy." To
continue the user has to click ( "Switch to..." or "Retry").
Typing in the command-line window:
--------
from win32com.client import Dispatch
myComObj = Dispatch("myApp.Application")
anotherComObj = myComObj.method()
res = anotherComObj.thisIsAVeryLongOperation()
--------
everything works fine (no popup message, thisIsAVeryLongOperation returning
without user interaction) but if I put it into a file and run it as a script
the message appears: why?
I tried to get rid of the popup with the solution proposed in
http://mail.python.org/pipermail/python-win32/2006-August/004923.html
--------
import win32ui
import win32uiole
from win32com.client import Dispatch
win32uiole.AfxOleInit()
win32uiole.SetMessagePendingDelay(aBigDelay);
win32uiole.EnableNotRespondingDialog(False);
win32uiole.EnableBusyDialog(False);
myComObj = Dispatch("myApp.Application")
anotherComObj = myComObj.method()
res = anotherComObj.thisIsAVeryLongOperation()
--------
without any effect.
pythoncom.CoInitialize() should also work, as suggested in
http://support.microsoft.com/?scid=kb%3Ben-us%3B248019
<http://support.microsoft.com/?scid=kb%3Ben-us%3B248019&x=14&y=15>
&x=14&y=15, but again no positive effect.
I was now looking for something like
(http://support.microsoft.com/kb/240809/en-us):
OLERequestPendingTimeout
to turn off the messages, but it seems not to be available in pywin32.
By the way, I am running:
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
pywin32-210.win32-py2.4
WinXP SP2
Thanks in advance. Any suggestion is welcome!
Mauro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080130/77100265/attachment.htm
More information about the python-win32
mailing list