Closed touchsky2018 closed 1 year ago
We added the following environment variables to our running docker container and had success after facing the same issue:
export URE_BOOTSTRAP=vnd.sun.star.pathname:/usr/lib/libreoffice/program/fundamentalrc
export PATH=/usr/lib/libreoffice/program:$PATH
export UNO_PATH=/usr/lib/libreoffice/program
export LD_LIBRARY_PATH=/usr/lib/libreoffice/program:/usr/lib/libreoffice/ure/lib
export PYTHONPATH=/usr/lib/libreoffice/program:$PYTHONPATH
for additional context, we are running it in Alpine too, so we added the ENV's to our docker file.
same here - no luck :(
Solution is to run unoconvert using the python used by libreoffice.
# Install libreoffice python finder
wget -O find_uno.py https://gist.githubusercontent.com/regebro/036da022dc7d5241a0ee97efdf1458eb/raw/find_uno.py
python3 find_uno.py
# Run the python script
python find_uno.py
or
python3 find_uno.py
# On mac it is located at /Applications/LibreOffice.app/Contents/Resources/python
# Use libreoffice python to run unoserver and unoconvert
/Applications/LibreOffice.app/Contents/Resources/python -m unoserver.server --executable /usr/local/bin/soffice
# Then we can safely run unoconvert the same way
# unoconvert requires the outfile to be explicit
/Applications/LibreOffice.app/Contents/Resources/python -m unoserver.converter --convert-to pdf "Input.docx" "Out.pdf"
I had install python3 and libreoffice, when i run libreoffice, No error when run unoserver, but, There is a error as following when I run unoconvert. Can you give some help. @regebro
Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/unoserver/converter.py", line 2, in
import uno
ModuleNotFoundError: No module named 'uno'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/bin/unoconvert", line 5, in
from unoserver.converter import main
File "/usr/lib/python3.7/site-packages/unoserver/converter.py", line 5, in
"Could not find the 'uno' library. This package must be installed with a Python "
ImportError: Could not find the 'uno' library. This package must be installed with a Python installation that has a 'uno' library. This typically means you should installit with the same Python executable as your Libreoffice installation uses.
killed: false, code: 1, signal: null,