Difference between revisions of "Python"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Where is the IDE ?)
Line 47: Line 47:
 
=== Getting Started ===
 
=== Getting Started ===
 
*[[Using Python on Windows]] - New to Python? Learn how to use python on Windows
 
*[[Using Python on Windows]] - New to Python? Learn how to use python on Windows
*[[Using Python on Linux]] - A must read for an overwiew on Python and OOo relations
+
*[[Using Python on Linux]] - A must read for an overview on Python and OOo relations
 
* [[pyUNO bridge]] - Official page of the PyUNO bridge at the [http://udk.openoffice.org/ UDK site]
 
* [[pyUNO bridge]] - Official page of the PyUNO bridge at the [http://udk.openoffice.org/ UDK site]
 
* [[Python as a macro language]] in OpenOffice.org 2.x - How to use the Python scripting framework
 
* [[Python as a macro language]] in OpenOffice.org 2.x - How to use the Python scripting framework
Line 61: Line 61:
 
*[[Danny's Python Modules]] - Collection guide from DannyB's modules.
 
*[[Danny's Python Modules]] - Collection guide from DannyB's modules.
 
*[[PrinttoWriter.py]] - This makes it easy and convenient to print a bunch of text into a Writer document.
 
*[[PrinttoWriter.py]] - This makes it easy and convenient to print a bunch of text into a Writer document.
*[http://www.oooforum.org/forum/viewtopic.phtml?t=8456 Developing Calc Funcions in Python] - Learn how Python can be used to script your spreadsheets
+
*[http://www.oooforum.org/forum/viewtopic.phtml?t=8456 Developing Calc Functions in Python] - Learn how Python can be used to script your spreadsheets
 
*[http://www.oooforum.org/forum/viewtopic.phtml?p=56037#56037 Generating a Spreadsheet through Python] - Automatically generate new spreadsheets
 
*[http://www.oooforum.org/forum/viewtopic.phtml?p=56037#56037 Generating a Spreadsheet through Python] - Automatically generate new spreadsheets
 
*[http://www.oooforum.org/forum/viewtopic.phtml?t=9115 Python container components]
 
*[http://www.oooforum.org/forum/viewtopic.phtml?t=9115 Python container components]
Line 70: Line 70:
 
*[[Zotero_Plugin |Zotero Plugin]] - The Zotero plugin provides citation and bibliographic table insertion and editing functions for Writer documents.
 
*[[Zotero_Plugin |Zotero Plugin]] - The Zotero plugin provides citation and bibliographic table insertion and editing functions for Writer documents.
  
=== Hacking Arround ===
+
=== Hacking Around ===
 
*[[UNO component packaging]] - How to create UNO components as well as the basics of script componentizing
 
*[[UNO component packaging]] - How to create UNO components as well as the basics of script componentizing
 
*[http://www.oooforum.org/forum/viewtopic.phtml?p=38234#38234 Python component to parse XML] - Python is great to parse XML, PyUNO is also excellent when working with XML
 
*[http://www.oooforum.org/forum/viewtopic.phtml?p=38234#38234 Python component to parse XML] - Python is great to parse XML, PyUNO is also excellent when working with XML

Revision as of 21:02, 12 August 2009

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

News

Efforts on moving PyUNO to Python 2.5 continue. Liyuan is pushing this initiative and has commited the CWS on the UDK mailing list the CWS however is not ready and was sent back on issue 71327.

Python and OpenOffice.org

OpenOffice.org ships with a python scripting language, version 2.3.4. This Python distribution comes with the Uno module which connects the UNO API with the python scripting language. To run this version of Python on Linux you can go to the direct OpenOffice.org PATH. OOo-Python can be run from the command line as well as you might expect with any other distribution of Python.

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

集成开发环境在哪?

OpenOffice.org的集成开发环境不支持Python,因此开发工作应该在其它的编辑器上完成,欢迎任何为绑定作贡献的志愿者。

Tips & Tricks

Here are some useful information, helping to use python in OOo

Debug output

If you launch a python script, any error will silently break the execution and your extension will be 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, which tell the pyUno bridge to log every call, set therefor the environment variable export PYUNO_LOGLEVEL=ARGS , the output is a little hard to read, but helpful during development.

This applies to Linix. For Windows you need some more switches and the output gets written to files (no stdout on windows :-( ).

Some error messages still don'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 packaging your code to be able to easily distribute your scripts through the OpenOffice.org package manager. Please check the tutorials on how to componentize your code as well as how to deploy remote scripting through a service implementation.

To learn to run Python on Windows you could visit this link for more detail information.

Getting Started

PyUNO Modules

Hacking Around

Python rules OOo (by B. Bois)

Python rules OOo :-)

Personal tools