On Wed, 2009-05-13 at 11:59 +1000, Mike Bissett wrote: > Looks like that could be the case as I'm getting this error when running the > script for a second time against a headless server: > > File "./DocumentConverter.py", line 165, in <module> > converter.print_convert(argv[1], argv[2]) > File "./DocumentConverter.py", line 109, in print_convert > document.close(True) > uno.RuntimeException: illegal object given! > > Any pointers on how I can wait for the print job to complete ? > I tried hacking in a sleep but that does not seem to help. when running out > of > headless mode a sleep of 200ms stops any errors.
This should work, i.e. using IsBusy to see if the printer is still working. http://api.openoffice.org/docs/common/ref/com/sun/star/view/PrinterDescriptor.html#IsBusy IsBusy = True while IsBusy: #get default printer pprops=document.getPrinter() properties print 'Printer is still busy' #pprops is a tuple, so use python's any, not to be confused #with OOo any, to search for a IsBusy named property IsBusy = any((x.Name == 'IsBusy' and x.Value == 1) for x in pprops) document.close(True) C. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org