Page 1 of 1

OOo 3.0 and Python

PostPosted: Thu Oct 16, 2008 11:49 am
by Villeroy
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.



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


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.

(windows only) When you try to connect to a running office process, you get 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/ 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

Re: OOo 3.0 and Python

PostPosted: Fri Oct 17, 2008 5:01 am
by jazzcat
My experience has been slightly different.

On Linux (CentOS 5.2), python-only scripts seem to run. The limited PyUNO functionality (a demo 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.

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...


Re: OOo 3.0 and Python

PostPosted: Fri Oct 17, 2008 1:55 pm
by Villeroy
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.