ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-win32
python-win32
RE: [python-win32] MSWord: Server Busy
by Mark Hammond other posts by this author
Sep 30 2004 3:45PM messages near this date
Re: [python-win32] MSWord: Server Busy | Re: [python-win32] win32com, excel and wx
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@[...].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@[...].gr
>  > vax@[...].gr
>  >
>  >
>  >
>  > > _______________________________________________
>  > Python-win32 mailing list
>  > Python-win32@[...].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@[...].org
>  http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
Python-win32 mailing list
Python-win32@[...].org
http://mail.python.org/mailman/listinfo/python-win32
Thread:
Bill Papadopoulos
Fabricio Guzman
Mark Hammond

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved