OOo 3.0 and Python

Keyboard macros or custom scripts

OOo 3.0 and Python

Postby Villeroy » Thu Oct 16, 2008 11:49 am

Jörg Budischewski on comp.openoffice.devel.udk wrote:Hi,

There are some problems with pyuno in OOo3.0.0 (in particular with the python executable). Here the known problems and the workarounds for the moment.

Bye,

Joerg
-----------------

1)( unix only), you need to set LD_LIBRARY_PATH correctly before starting the python executable, eg.

export set LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../openoffice.org/ure/lib:../../openoffice.org/basis3.0/program
./python


2) (windows only) The python scripting framework (scripts within openoffice via Extras/Macro/) does not work (at least for me). The cause is unknown and under investigation.

3)
(windows only) When you try to connect to a running office process, you get

__main__.com.sun.star.connection.NoConnectException: Connector couldn't connect to socket (WSANOTINITIALISED, WSAStartup() has not been called)

You can workaround this, by placing a

import socket

at the top of your script.

4) (windows only) The python program crashes or you get an attribute error

AttributeError: getCurrentComponent (or some other attribute)

This is because the types could not be loaded due to changes in the uno bootstrapping mechanism. You can work around it for now by setting the variable set URE_BOOTSTRAP=fundamental.ini

and running python from the
path/to/office/OpenOffice.org 3/programdirectory.


5) (windows only) Interactive mode in python does not work correctly When you start the python executable without parameters, the interactive session runs somewhat fuzzy (at least on my machine). When you get the prompt >>>> , everything you type will be interpreted as a shell command. When you then just press return, you are prompted with your current working directory, here you can place a python command. Both input modes alternate.


Bye, bye OpenOffice.org
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24650
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: OOo 3.0 and Python

Postby jazzcat » Fri Oct 17, 2008 5:01 am

My experience has been slightly different.

On Linux (CentOS 5.2), python-only scripts seem to run. The limited PyUNO functionality (a demo dialog.py I found somewhere) does run, but I have not tested all PyUno functionality. If I compile a C-based Python module (with a Python 2.3.7 that I also compiled), when the module is run the soffice.bin process segfaults.

Windows XP is slightly better. I can even run C-based python modules (through a set of gymnastics), and some PyUno stuff works. However, there is still the problem I posted on the oooforum site.

http://www.oooforum.org/forum/viewtopic.phtml?t=76059

Since I found out that you may be able to do web service calls out of OOO Basic, I may abandon Python for OOo dev for the time being...

Cheers,
-Josh
OOo 2.3.X on Fedora other + Windows XP, Vista Ultimate
jazzcat
 
Posts: 1
Joined: Fri Oct 17, 2008 4:46 am

Re: OOo 3.0 and Python

Postby Villeroy » Fri Oct 17, 2008 1:55 pm

IMPORTANT: Workarounds for pyuno problems in OOo3.0.0
Well, that does not help distributing our macros and add-ons. Before I fall back to StarBasic I'd rather ignore OOo3 alltogether, except for version 2.4.1 and the dozend of documents and templates I actually use with it (most of them since version 1). This implies that I could not be a contributing member of the user-community anymore.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24650
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 6 guests