[python-win32] MSWord: Server Busy

Mark Hammond mhammond at skippinet.com.au
Fri Oct 1 00:44:18 CEST 2004


Sleeping and hard loops like this may turn out to be part of the problem.
You should enter a loop calling PumpWaitingMessages - something like:

end = time.time() + 5 # stop in 5 secs.
while time.time() < end:
    pythoncom.PumpWaitingMessages()
    time.sleep(0.2)

Mark

> How about trapping the error with a try block:
>
> bWorked = false
>
> while bWorked == false
>    try
>       wordApp.ActiveDocument.PageSetup.TopMargin = 5
>       bWorked = true
>    catch
>
>
> it's not pretty but it will try and try until the
> server is finished initializing.
>
> -Fabricio
>
> --- Bill Papadopoulos <b_papadopoulos at iris.gr> wrote:
>
> >
> > >>Hi !
> >
> > >>"server busy"  c'est souvent du au temps de
> > lancement de ms-word
> > >> "server busy"  it's often because ms-word is slow
> > to begin to run.
> > >>Ajoute/Add   "time.sleep(5)"
> > >>Michel Claveau
> >
> >
> > Hello Michael and thank your for responding,
> >
> > This is what I do before I get the "Server Busy"
> > message:
> >
> > #Setting TopMargin
> > wordApp.ActiveDocument.PageSetup.TopMargin = 5
> >
> > where wordApp is my Dispatch object.
> >
> >
> > I 've already tried time.sleep() after setting the
> > Margin which resulted
> > to a "server busy" message and then the script
> > "slept".
> >
> > Also, I tried time.sleep() before setting the Margin
> > which resulted
> > to make the script wait and then to get the "server
> > busy" message.
> >
> > I need something like:
> >
> > while waiting for margin to be set:
> >     time.sleep()
> >
> > Any suggestions?
> > Anyway, thanks again!
> >
> >
> > Vax
> > ____________________
> > b_papadopoulos at iris.gr
> > vax at cls.gr
> >
> >
> >
> > > _______________________________________________
> > Python-win32 mailing list
> > Python-win32 at python.org
> > http://mail.python.org/mailman/listinfo/python-win32
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the Python-win32 mailing list