PyUNO with different Python

  • Thread starter =?ISO-8859-1?Q?Katja_S=FCss?=
  • Start date
?

=?ISO-8859-1?Q?Katja_S=FCss?=

Hi!
maybe somebody can give me an hint to my problem setting up PyUNO on my
Mac to work with my Python not the Python delivered with OpenOffice.
As said in installation instructions I've set
OPENOFFICE_PATH="/usr/lib/openoffice/program"
export PYTHONPATH="$OPENOFFICE_PATH"
export LD_LIBRARY_PATH="$OPENOFFICE_PATH"
according to my environment.

importing uno gives me this error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/Applications/OpenOffice.org
2.0.app/Contents/openoffice.org2.0/program/uno.py", line 37, in ?
import pyuno
ImportError: No module named pyuno

which means python finds uno but not pyuno (pyuno.dylib).

Any hints?
Regards, Katja
 
M

Michele Petrazzo

� said:
Hi! maybe somebody can give me an hint to my problem setting up PyUNO
on my Mac to work with my Python not the Python delivered with
OpenOffice. As said in installation instructions I've set
OPENOFFICE_PATH="/usr/lib/openoffice/program" export
PYTHONPATH="$OPENOFFICE_PATH" export
LD_LIBRARY_PATH="$OPENOFFICE_PATH" according to my environment.

importing uno gives me this error:

Traceback (most recent call last): File "<stdin>", line 1, in ? File
"/Applications/OpenOffice.org
2.0.app/Contents/openoffice.org2.0/program/uno.py", line 37, in ?
import pyuno ImportError: No module named pyuno

which means python finds uno but not pyuno (pyuno.dylib).

Do you want to use system python inside OOo (inside a macro, or...), or
system python outside OOo?

For the first, follow this:
http://udk.openoffice.org/python/python-bridge.html#replacing

for the second:
http://udk.openoffice.org/python/python-bridge.html#modes
Any hints? Regards, Katja

Michele
 
M

Méta-MCI

Hi!

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.



@+

MCI
 
K

Katja Suess

Michele said:
Do you want to use system python inside OOo (inside a macro, or...), or
system python outside OOo?

For the first, follow this:
http://udk.openoffice.org/python/python-bridge.html#replacing

for the second:
http://udk.openoffice.org/python/python-bridge.html#modes




Michele

Thanks. What I have in mind is to write a Python script to generate PDFs from a set of ODTs.
This script has to run in Zope which brings its own Python.
My problem is the setup of PyUNO with this Python which is not the OO included one.
Hope to find a Mac user who made/solved similar experience...
Regards, Katja
 
S

Stefan Behnel

Méta-MCI said:
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 ...

Stefan
 
M

Michele Petrazzo

Stefan said:
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;"

Michele
 
M

Michele Petrazzo

Katja said:
Thanks. What I have in mind is to write a Python script to generate
PDFs from a set of ODTs.

Pay attention that you have a OOo program running somewhere that accept
the connection from your zope server (I don't think that you have a X
server running on it.)
This script has to run in Zope which brings its own Python. My
problem is the setup of PyUNO with this Python which is not the OO
included one.

Try with the little modify that I wrote and the other post and let us know.
Hope to find a Mac user who made/solved similar experience...
Regards, Katja

Michele
 
M

Méta-MCI

hmmmm...

I can run OK "hello_world.py". But only with Python-core-2.3

Python 2.4 don't run (conflict-version, or windows error).
And, it's not possible to install extensions (like PyWin) to Python-core-2.3
(this destroy the same extensions in my "normal" Python 2.4)

I had let down these aspects of OOo.

*sorry for my bad english*

MCI
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top