Hi,

please check, what sourceDoc is e.g. with

print sourceDoc
unohelper.inspect( sourceDoc )


and whether it supports the desired interface. I think you get this message, when sourceDoc is None.

Bye,

Joerg

Laurent Godard wrote:
Hi all

i simply try to load/export a file using PyUNO in OOo2 (m118)
(code at the end)

i end with this error
Traceback (most recent call last):
  File "./testMe.py", line 23, in ?
    sourceDoc.storeToURL(url,args)
AttributeError: storeToURL


while all is ok with 1.1.4
the same code (or nearly) as macro works

I tried alot of source files, target format (PDF, MS, nothoing ..)
same result ...
same also with a storeAsURL

Is it a known issue ? Am I to tired ?

Thanks in advance

laurent
'----------------
import uno, unohelper
from com.sun.star.beans import PropertyValue


theSourceFile="/home/lgodard/Chronique.sxw"
theTargetFile="/home/lgodard/tmp/toto.pdf"

localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext('com.sun.star.bridge.UnoUrlResolver', localContext ) ctx = resolver.resolve('uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext'
                % ('localhost', '2002'))

smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext('com.sun.star.frame.Desktop',ctx)

args = (PropertyValue('Hidden', 0, False, 0),)
url = unohelper.systemPathToFileUrl(theSourceFile)
sourceDoc = desktop.loadComponentFromURL(url, '_blank', 0, args)

url = unohelper.systemPathToFileUrl(theTargetFile)
args = (PropertyValue('FilterName', 0, 'writer_pdf_Export', 0),)

sourceDoc.storeToURL(url,args)
sourceDoc.close(True)






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to