Difference between revisions of "Python"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
(Remove bit old description)
Line 1: Line 1:
 
{{Extensions}}
 
{{Extensions}}
 
[[image:Py-uno_128.png|PyUNO Logo]] [[image:Pyuno_logo_a.jpg]]  
 
[[image:Py-uno_128.png|PyUNO Logo]] [[image:Pyuno_logo_a.jpg]]  
=== News ===
 
Efforts on moving PyUNO to '''Python 2.5''' continue.  Liyuan is pushing this initiative and has [http://udk.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=3704 commited the CWS] on the UDK mailing list.  The [[CWS]], however, is not ready, and was sent back on issue [http://www.openoffice.org/issues/show_bug.cgi?id=71327 71327].
 
  
 
=== Python and OpenOffice.org ===
 
=== Python and OpenOffice.org ===
OpenOffice.org ships with the python scripting language, version 2.3.4. This Python distribution comes with the [[Uno]] module, which connects the [[API|UNO API]] to the python scripting language.  To run this version of Python on Linux, you can go directly to the OpenOffice.org PATH.  And as one would expect with any distribution of Python, OOo-Python can be run from the command line as well.
+
OpenOffice.org ships with the python scripting language, version 2.6.1 since 3.1. Older OpenOffice.org ships with Python version 2.3.4. This Python distribution comes with the [[Uno]] module, which connects the [[API|UNO API]] to the python scripting language.  To run this version of Python on Linux, you can go directly to the OpenOffice.org PATH.  And as one would expect with any distribution of Python, OOo-Python can be run from the command line as well.
  
 
==== Where is the IDE ? ====
 
==== Where is the IDE ? ====

Revision as of 13:17, 19 June 2010

OOo Extensions project

Please view the wiki usage guidelines
before contributing.

Categories:

Pages:

Extensions on the main site

Extensions in other languages:
ES - FR - IT - JA - NL - OC -

PyUNO Logo Pyuno logo a.jpg

Python and OpenOffice.org

OpenOffice.org ships with the python scripting language, version 2.6.1 since 3.1. Older OpenOffice.org ships with Python version 2.3.4. This Python distribution comes with the Uno module, which connects the UNO API to the python scripting language. To run this version of Python on Linux, you can go directly to the OpenOffice.org PATH. And as one would expect with any distribution of Python, OOo-Python can be run from the command line as well.

Where is the IDE ?

OpenOffice.org's IDE doesn't support Python, so development has to be done from another editor that does. Any volunteer for a binding is welcomed.

Tips & Tricks

Here is some useful information about using python in OOo.

Debug output

If you launch a python script, any error will silently break the execution, making your extension hard to debug. To change this behaviour, one can change the LogLevel .

Have a look in /path/to/ooo/program/pythonscript.py and replace LogLevel.use = LogLevel.NONE with LogLevel.use = LogLevel.DEBUG .

There are also currently-undocumented environment variables that tell the pyUno bridge to log every call. Set the environment variable export PYUNO_LOGLEVEL=ARGS . The output may be a little hard to read, but helpful nonetheless.

Note that his applies only to Linux. For Windows, you need some more switches, and the output gets written to files (there is no stdout on windows :-( ).

There are still some error messages that won't appear in these logs; this will improve in the near future (cws pyunofixes4). Once the cws is integrated, I will document these switches on the official pyuno site.

Thanks to Joerg Budischewski .

Python specific information for Extension creation

To create extensions for python, it is important that you have enough familiarity with the UNO components, as well as with packaging your code for easy distribution through the OpenOffice.org package manager. Please check the tutorials to learn how to component-ize your code, and how to deploy remote scripting through a service implementation.

To learn to run Python on Windows, visit this link for more detailed information.

Getting Started

PyUNO Modules

Hacking Around

Python rules OOo (by B. Bois)

Python rules OOo :-)

Personal tools