PyUNO with different Python

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Thu Feb 23 03:52:21 EST 2006


Stefan Behnel wrote:
> M�ta-MCI schrieb:
>> The second way don't run:
>> 
>> Traceback (most recent call last): File "C:\Program
>> Files\OpenOffice.org 2.0\program\hello_world.py", line 1, in? 
>> import uno File "C:\Program Files\OpenOffice.org
>> 2.0\program\uno.py", line 37, in ? import pyuno ImportError: Module
>> use of python23.dll conflicts with this version of Python.
> 
> Sounds like you might want to switch back to Python 2.3 ...
> 

Yes and no.
I have both 2.3 and 2.4 on my debian system and with both, the program
at: http://udk.openoffice.org/python/samples/ooextract.py

work well with a modify:
before the first line "import uno", add:

import sys
sys.path.append("/opt/openoffice.org2.0/program/")

Now, save the program, move it where you want, and go:

michele:~$ python2.3 tmp/ooextract.py --pdf test.odt
michele:~$ python2.4 tmp/ooextract.py --pdf test.odt

Both create the test.pdf file!

P.s. Before execute the script, execute OOo:
soffice "-accept=socket,host=localhost,port=2002;urp;"

> Stefan

Michele



More information about the Python-list mailing list