On 01/20/11 13:43, Sandro wrote:
The simple demo that raises an error is:import os import uno from com.sun.star.beans import PropertyValue OutOfBoundsException = uno.getClass("com.sun.star.lang.IndexOutOfBoundsException") local = uno.getComponentContext() resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolv er", local) context = resolver.resolve("uno:socket,host=192.168.5.1,port=8100;urp;StarOffice.Component Context") desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context) filename = r"%s/template-debug.odt" % os.getcwd() print filename, os.path.exists(filename) # filename exists!!! document = desktop.loadComponentFromURL(u"file://" +filename ,"_blank", 0, ())
Not having seen the exact text of the error message (i.e., not being sure it is a problem of having a "loadComponentFromURL" method available to call in the first place vs. a problem "within" the loadComponentFromURL call), one idea that comes to mind is that, in the failing scenario, u"file://"+filename happens to be no valid URL (e.g., filename not starting with a slash; filename containing spaces).
-Stephan --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
