Using pyuno with my existing python installation

I am trying to use PyUNO as a method to convert various document formats (doc, wordperfect, html, etc.) to PDF from my Django server. I need time to import unowork. It seems to be failing when executed import pyunowith the message ImportError: DLL Load Failed: The specified module could not be found.

The only way to get this to work is to use Python 2.6, which comes with OpenOffice, but I really want to use my other installation of 2.6. The documents for PyUNO are for Python 2.2 and are thought to be out of date.

I assume that some (or all) of the following files need to be copied from the OpenOffice directory to the directory of my package site (or to some subdirectory of it):

pythonloader.py
pythonloader.uno.ull
pythonloader.uno.ini
pythonscript.py
pyuno.pyd

Has anyone been successful for this to work?

This is on Windows.

+3
source share
3 answers

For simple conversions you do not need to reinvent the wheel. Take a look at unoconv: http://dag.wieers.com/home-made/unoconv/

"Import uno" will automatically work if the python interpreter has been linked to OpenOffice or on some Linux systems where the packages have already done a lot of work for you.

Alternative 1 . For other Python installations on Win32 systems, you need to import three environment variables and add one element to your Pythonpath. A detailed guide is at http://user.services.openoffice.org/en/forum/viewtopic.php?f=45&t=36370&p=166783

, OO- Python Python: ( Python 2.6 OO 3.1.2)

  • os.environ ['URE_BOOTSTRAP'] = 'vnd.sun.star.pathname: c:\Program Files\OpenOffice.org 3\program\basic.ini'
  • os.environ ['UNO_PATH'] = 'c:\Program Files\OpenOffice.org 3\program \'
  • os.environ ['PATH']. append ('c:\Program Files\OpenOffice.org 3\URE\bin; c:\Program Files\OpenOffice.org 3\Basis\program;')

pythonpath, Python, - uno:

  • sys.path.append('C:\Program Files\OpenOffice.org 3\Basis\program')

" uno".

Pyuno Python. OO 3.1 Python 2.6.1, pyuno Python 2.6. uno Python . 2.

2. Python WIN32 Python-UNO Python-COM. , API , Python, Python3.

+2

. Windows XP , SQL- excel. .. OpenOffice. .

, uno modude, python.exe openoffice. exec py - , .

, Linux Pyuno , , , . python exec openoffice python 2.7, pyuno DDL, DDL.

0

, " ". , , stdlib, / python python.org, stdlib, / python.exe, OpenOffice.org. , , , . , .

0

Source: https://habr.com/ru/post/1776774/


All Articles