mythcat Newbie

Joined: 26 Oct 2007 Posts: 2 Location: Bucuresti
|
Posted: Sun Oct 28, 2007 7:46 am Post subject: some problems ... |
|
|
I try to use sopenoffice + python !
I use python2.4 and openoffice 2.0
Problem :
I see this example http://codesnippets.services.openoffice.org/Office/Office.PythonBootstrapModule.snip
and i try to use on this mode :
| Code: |
import os
import random
from sys import platform
from time import sleep
import uno
from com.sun.star.connection import NoConnectException
from com.sun.star.uno import Exception as UnoException
sOffice = os.path.join("/usr/lib/openoffice/program/soffice", "soffice")
if platform.startswith("win"):
sOffice += ".exe"
random.seed()
sPipeName = "uno" + str(random.random())[2:]
cmdArray = (sOffice, "-nologo", "-nodefault", "".join(["-accept=pipe,name=", sPipeName, ";urp;"]))
os.spawnv(os.P_NOWAIT, sOffice, cmdArray)
xLocalContext = uno.getComponentContext()
resolver = xLocalContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xLocalContext)
sConnect = "".join(["uno:pipe,name=", sPipeName, ";urp;StarOffice.ComponentContext"])
xContext = resolver.resolve(sConnect)
|
the output is this error:
| Code: | python oo.py
Traceback (most recent call last):
File "oo.py", line 24, in ?
xContext = resolver.resolve(sConnect)
uno.com.sun.star.connection.NoConnectException: Connector : couldn't connect to pipe uno49118954922(10)
|
Have some suggestion for me ?
Thanks !
I suppouse is from this line
| Code: | | cmdArray = (sOffice, "-nologo", "-nodefault", "".join(["-accept=pipe,name=", sPipeName, ";urp;"])) |
You see
and i try some example with | Code: | | -accept="socket,host=localhost,port=2002;urp;" |
and is work . The diff is this " but i not sure ...
sorry but i d'ont speak very well eng . |
|