PyUNO with different Python

Discussion in 'Python' started by =?ISO-8859-1?Q?Katja_S=FCss?=, Feb 22, 2006.

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

    >>> import uno

    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
    =?ISO-8859-1?Q?Katja_S=FCss?=, Feb 22, 2006
    #1
    1. Advertising

  2. � wrote:
    > 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:
    >
    >>>> import uno

    > 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
    Michele Petrazzo, Feb 22, 2006
    #2
    1. Advertising

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

    Méta-MCI Guest

    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
    Méta-MCI, Feb 22, 2006
    #3
  4. =?ISO-8859-1?Q?Katja_S=FCss?=

    Katja Suess Guest

    Michele Petrazzo schrieb:
    > � wrote:
    >
    >>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:
    >>
    >>
    >>>>>import uno

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


    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
    Katja Suess, Feb 22, 2006
    #4
  5. 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 ...

    Stefan
    Stefan Behnel, Feb 23, 2006
    #5
  6. 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
    Michele Petrazzo, Feb 23, 2006
    #6
  7. Katja Suess wrote:
    > 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
    Michele Petrazzo, Feb 23, 2006
    #7
  8. =?ISO-8859-1?Q?Katja_S=FCss?=

    Méta-MCI Guest

    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
    Méta-MCI, Feb 25, 2006
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jochen Knuth
    Replies:
    0
    Views:
    366
    Jochen Knuth
    Jul 15, 2003
  2. Thomas Guettler

    pyUNO: Converting doc/sxw to html/ps

    Thomas Guettler, Nov 26, 2003, in forum: Python
    Replies:
    1
    Views:
    362
    Thomas Guettler
    Nov 26, 2003
  3. Thomas Guettler

    Solved: pyUNO Converter

    Thomas Guettler, Nov 27, 2003, in forum: Python
    Replies:
    4
    Views:
    1,054
    yawar
    Aug 3, 2004
  4. John Hunter

    handling xls with pyuno

    John Hunter, Jan 28, 2005, in forum: Python
    Replies:
    1
    Views:
    365
    Guido Goldstein
    Jan 28, 2005
  5. Max Muxe
    Replies:
    1
    Views:
    314
    Méta-MCI
    Feb 25, 2006
Loading...

Share This Page