[Solved] NoConnectException

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
mrcactu5
Posts: 2
Joined: Thu Jan 10, 2008 10:13 pm

[Solved] NoConnectException

Post by mrcactu5 »

I tried following the pyUno tutorial on this page: http://udk.openoffice.org/python/python-bridge.html

It gives me this problem:

File "oo_helloworld.py", line 11, in ?
ctx = resolver.resolve( "uno:socket, host = localhost, port= 2002; urp; StarOffice.ComponentContext" )
__main__.com.sun.star.connection.NoConnectException: Connector: couldn't connect to socket (WSAECONNREFUSED, Connection Refused)


I pretty much copy-pasted the code from the web site above, so it should work. What might I be doing wrong?

- JM
Last edited by Hagar Delest on Mon Jul 23, 2012 8:28 am, edited 1 time in total.
Reason: tagged [Solved].
QuazzieEvil
Volunteer
Posts: 283
Joined: Tue Dec 04, 2007 6:38 pm
Location: Houston, TX

Re: NoConnectException

Post by QuazzieEvil »

did you start openoffice and set it to accept connections on that port?

something like: c:\Program Files\OpenOffice1.1\program> soffice "-accept=socket,host=localhost,port=2002;urp;" for windows
the command is the same for linux, but you have to find the directory for 'soffice'

if you have not done this, this may be the problem.
mrcactu5
Posts: 2
Joined: Thu Jan 10, 2008 10:13 pm

Re: NoConnectException

Post by mrcactu5 »

We eventually got it to work. Restarting the computer and installing the most recent version 2.3 seem to have done the trick. Also... you have to open Writer yourself.
Danny's Python modules are good : http://www.oooforum.org/forum/viewtopic.phtml?t=14409 and here is an example using that module. http://www.oooforum.org/forum/viewtopic ... 6037#56037
  • in Danny's version you listen to port 8100,
    you have to open run Python in OpenOffice\Program,
    you have to use OpenOffice's version of Python with .\Python
    if you import Danny's module you have to put "Danny.Ooo.OOoLib" in front of all the methods
    Be sure to change the outpul file name in Danny's example to a folder that actually exists on your computer.
    etc
but all of this can be really confusing for the beginner. [SOLVED.]
setori88
Posts: 3
Joined: Thu Oct 16, 2008 6:08 am

Re: NoConnectException

Post by setori88 »

seems 3.0 has something similar ...

at the top of the script type

import socket

which will lead you to the second problem which is

AttributeError: getCurrentComponent

look to see
http://www.nabble.com/Workarounds-for-p ... #a20006733
OOo 3.0.X on Ms Windows XP
kaclem
Posts: 1
Joined: Fri Jul 08, 2011 10:07 am

Re: NoConnectException

Post by kaclem »

setori88 wrote:seems 3.0 has something similar ...
yeah, looks like the same problem
Post Reply