turulomio/unogenerator

Installation issues

kunago opened this issue · 10 comments

I am failing to install unogenerator so could someone with a working version help me out please?

Let's say I want to dockerize it:

FROM python:3-alpine
RUN apk update &&\
    apk add libreoffice
RUN pip3 install uno unogenerator

I have to install both, uno and base because without it unogenerator complains. As I assumed all requirements were satisfied, I run the demo python script from the doc with this content:

from unogenerator import ODT_Standard
doc=ODT_Standard()
doc.addParagraph("Hello World", "Heading 1")
doc.addParagraph("Easy, isn't it","Standard")
doc.save("hello_world.odt")
doc.export_docx("hello_world.docx")
doc.export_pdf("hello_world.pdf")
doc.close()

This is however the error I get once I run it:

Traceback (most recent call last):
  File "/srv/lo/test.py", line 1, in <module>
    import uno
  File "/usr/local/lib/python3.10/site-packages/uno/__init__.py", line 4, in <module>
    from base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
ImportError: cannot import name 'Element' from 'base' (/usr/local/lib/python3.10/site-packages/base/__init__.py)

Is there any other requirement I am missing?

As I found out, I misunderstood what needs to be installed. The uno module shall not be installed via pip but rather with python-uno package. This is a note in pyoo project which seems to be the answer for this issue as well:

The only dependency is the Python-UNO library (imported as a module uno). Unfortunately Python-UNO cannot be installed using pip. Do NOT install package named uno available on PyPI - it’s not related to LibreOffice.

Although I did install the module python3-uno (Debian-based image), I still the error concerning uno module. This time it is simply missing:

Traceback (most recent call last):
  File "/srv/test.py", line 1, in <module>
    from unogenerator import ODT_Standard
  File "/usr/local/lib/python3.10/site-packages/unogenerator/__init__.py", line 3, in <module>
    from .unogenerator import ODT, ODS, ODT_Standard, ODS_Standard
  File "/usr/local/lib/python3.10/site-packages/unogenerator/unogenerator.py", line 6, in <module>
    from uno import getComponentContext, createUnoStruct, systemPathToFileUrl, Any, ByteSequence
ModuleNotFoundError: No module named 'uno'

Hi Kunago.

Only Linux is supported.

Python uno module is installed with Libreoffice installation (it's not an external module), at least in Gentoo

I've written a new installation file INSTALL.md to try to help you and others to install Unogenerator

Debian should be similar to Kubuntu

I've executed this command in kubuntu (live cd), after unogenerator installation, to see wich uno packages are installed:
apt list| grep -i uno

clamav-unofficial-sigs/impish 3.7.2-2.1 all
golang-github-dropbox-dropbox-sdk-go-unofficial-dev/impish 5.4.0-2 all
libghc-unordered-containers-dev/impish 0.2.10.0-3build2 amd64
libghc-unordered-containers-doc/impish 0.2.10.0-3build2 all
libghc-unordered-containers-prof/impish 0.2.10.0-3build2 amd64
libjs-unorm/impish 1.6.0-2 all
libtest-deep-unorderedpairs-perl/impish 0.006-1 all
libuno-cppu3/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
libuno-cppuhelpergcc3-3/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
libuno-purpenvhelpergcc3-3/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
libuno-sal3/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
libuno-salhelpergcc3-3/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
libunoil-java/impish 1:7.2.1-0ubuntu3 all
libunoloader-java/impish 1:7.2.1-0ubuntu3 all
node-unorm/impish 1.6.0-2 all
python3-junos-eznc/impish 2.1.7-3 all
python3-uno/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
runoverssh/impish 3.0.3-1 all
uno-libs-private/impish,now 1:7.2.1-0ubuntu3 amd64 [instalado, automático]
unoconv/impish 0.7-2 all
vim-khuno/impish 1.0.3-3 all

I hope that help you

Check unogenerator 0.22.0 is installed, due to in 0.21.0 pytz pip dependency was missing

Even when I try to install libreoffice-writer or libreoffice-calc, I don't see anywhere the packages starting with libuno and those are missing and apparently required even for the python import to work fine.

The command

apt list | grep libuno

returns nothing. That is weird.

EDIT:

I found out the packages are missing from Debian because they are only in the backports. To contribute, I will create a Dockerfile that fully installs unogeneratator on Debian and you can add it to your repo if you want.

EDIT:

I had partial success; I am able to run unogenerator_start command and it seems to pass.

Preparing 8 libreoffice server instances from port 2002:
  - Launched instance in port 2002
  - Launched instance in port 2003
  - Launched instance in port 2004
  - Launched instance in port 2005
  - Launched instance in port 2006
  - Launched instance in port 2007
  - Launched instance in port 2008
  - Launched instance in port 2009

Then when trying to generate the demo, these two errors pop up multiple times:

Unsupported URL <file:///usr/local/lib/python3.7/dist-packages/unogenerator/templates/standard.odt>: "type detection failed"
Changing port 2002 to 2003 0 times
Unsupported URL <file:///usr/local/lib/python3.7/dist-packages/unogenerator/templates/standard.odt>: "type detection failed"
Changing port 2003 to 2004 1 times
...

and

This process died
concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.7/concurrent/futures/process.py", line 232, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/usr/local/lib/python3.7/dist-packages/unogenerator/demo.py", line 261, in demo_odt_standard
    doc=ODT_Standard(port)
  File "/usr/local/lib/python3.7/dist-packages/unogenerator/unogenerator.py", line 928, in __init__
    self.deleteAll()
  File "/usr/local/lib/python3.7/dist-packages/unogenerator/unogenerator.py", line 126, in deleteAll
    self.executeDispatch(".uno:SelectAll")
  File "/usr/local/lib/python3.7/dist-packages/unogenerator/unogenerator.py", line 131, in executeDispatch
    oDisp.executeDispatch(self.document.getCurrentController().Frame, command, "", 0, ())
AttributeError: 'ODT_Standard' object has no attribute 'document'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/unogenerator_demo", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/unogenerator/demo.py", line 66, in main
    future.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
AttributeError: 'ODT_Standard' object has no attribute 'document'
Unsupported URL <file:///usr/local/lib/python3.7/dist-packages/unogenerator/templates/standard.odt>: "type detection failed"
Changing port 2002 to 2003 0 times
Unsupported URL <file:///usr/local/lib/python3.7/dist-packages/unogenerator/templates/standard.odt>: "type detection failed"
Changing port 2003 to 2004 1 times

It seems that uno problem has been fixed. But unogenerator_demo script seems it can't detect instances to build documents.

Try to run ps aux to see process you should see lots of lines (depends on the number of instances) with sometthing like this

root     22653  0.0  0.0  11292  3680 pts/1    S    12:05   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2002;urp;StarOffice.ServiceManager -env:UserInstallation=file:///tmp/unogenerator2002 --headless
root     22656  0.0  0.0  97052  4796 pts/1    Sl   12:05   0:00 /usr/lib64/libreoffice/program/oosplash --accept=socket,host=localhost,port=2002;urp;StarOffice.ServiceManager -env:UserInstallation=file:///tmp/unogenerator2002 --headless
root     23034  0.2  0.5 427380 94836 pts/1    Sl   12:05   0:00 /usr/lib64/libreoffice/program/soffice.bin -env:UserInstallation=file:///tmp/unogenerator2002 --accept=socket,host=localhost,port=2002;urp;StarOffice.ServiceManager --headless

Check If loffice program is in your PATH and with that name

Try to run unogenerator_stop and then unogenerator_start. Then rerun unogenerator_demo --create

If the problem hasn't been fixed yet, and you have loffice process running, Try this:

I use python3.9, but I think that python3.7 should be compatible. I think problem are little differences between distributions, perhaps paths of template "Standard.odt"

In my distro templates are in this path

/usr/lib/python3.9/site-packages/unogenerator/templates/standard.ods
/usr/lib/python3.9/site-packages/unogenerator/templates/standard.odt

Try this code that doesn't need standard template (ODT instead of ODT_Standard)

from unogenerator import ODT
doc=ODT()
doc.addParagraph("Hello World", "Heading 1")
doc.addParagraph("Easy, isn't it","Standard")
doc.save("hello_world.odt")
doc.export_docx("hello_world.docx")
doc.export_pdf("hello_world.pdf")
doc.close()

I tested quite a few things and it does not seem to be linked to Python version. This is the setup:

root@srv:~# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"



root@srv:~# python3 --version
Python 3.9.2



root@srv:~# pip list
Package      Version
------------ -------
colorama     0.4.4
humanize     4.0.0
pip          22.0.4
polib        1.1.1
psutil       5.9.0
pytz         2021.3
setuptools   52.0.0
tqdm         4.63.0
unogenerator 0.22.0
wheel        0.34.2



root@srv:~# which loffice
/usr/bin/loffice



root@srv:~# apt list | grep -i uno
clamav-unofficial-sigs/stable 3.7.2-2.1 all
golang-github-dropbox-dropbox-sdk-go-unofficial-dev/stable 5.4.0-2 all
libghc-unordered-containers-dev/stable 0.2.10.0-3+b1 amd64
libghc-unordered-containers-doc/stable 0.2.10.0-3 all
libghc-unordered-containers-prof/stable 0.2.10.0-3+b1 amd64
libjs-unorm/stable 1.6.0-2 all
libtest-deep-unorderedpairs-perl/stable 0.006-1 all
libuno-cppu3/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed,automatic]
libuno-cppuhelpergcc3-3/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed,automatic]
libuno-purpenvhelpergcc3-3/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed,automatic]
libuno-sal3/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed,automatic]
libuno-salhelpergcc3-3/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed,automatic]
libunoil-java/stable,stable-security,now 1:7.0.4-4+deb11u1 all [installed,automatic]
libunoloader-java/stable,stable-security,now 1:7.0.4-4+deb11u1 all [installed,automatic]
node-unorm/stable 1.6.0-2 all
python3-junos-eznc/stable 2.1.7-3 all
python3-uno/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed]
runoverssh/stable 3.0.3-1 all
uno-libs-private/stable,stable-security,now 1:7.0.4-4+deb11u1 amd64 [installed,automatic]
unoconv/stable 0.7-2 all
vim-khuno/stable 1.0.3-3 all



root@srv:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        16  0.0  0.0   2416   540 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2002;urp;S
root        18  0.0  0.0 153644  3556 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        19  0.0  0.0   2416   524 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2003;urp;S
root        21  0.0  0.0  88108  3616 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        22  0.0  0.0   2416   588 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2004;urp;S
root        24  0.0  0.0  88108  3572 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        25  0.0  0.0   2416   524 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2005;urp;S
root        27  0.0  0.0  88108  3568 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        28  0.0  0.0   2416   584 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2006;urp;S
root        30  0.0  0.0  88108  3568 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        31  0.0  0.0   2416   520 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2007;urp;S
root        33  0.0  0.0  79912  3532 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        34  0.0  0.0   2416   512 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2008;urp;S
root        48  0.0  0.0   2416   524 pts/0    S    21:14   0:00 /bin/sh /usr/bin/loffice --accept=socket,host=localhost,port=2009;urp;S
root        49  0.0  0.0  88108  3588 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root        50  0.0  0.0  88108  3536 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/oosplash --accept=socket,host=localhost,po
root       154  0.0  1.8 401236 75032 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       157  0.0  1.8 401248 74700 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       158  0.0  1.8 401248 74864 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       160  0.0  1.8 401248 74620 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       162  0.0  1.8 401248 74544 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       164  0.0  1.9 1409144 78048 pts/0   Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       165  0.0  1.8 401248 74832 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///
root       166  0.0  1.8 401248 74656 pts/0    Sl   21:14   0:00 /usr/lib/libreoffice/program/soffice.bin -env:UserInstallation=file:///

The output of commands is following:

For unogenerator_demo --create I received:

root@srv:~# unogenerator_demo --create
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 0 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 0 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 0 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 0 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 1 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 1 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 1 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 1 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 2 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 2 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 2 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 3 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 2 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 3 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 3 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 4 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 3 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 4 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 4 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 5 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 4 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 5 times
Binary URP bridge disposed during call ./binaryurp/source/bridge.cxx:612
Changing port 2007 to 2008 5 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 5 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 6 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 6 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 6 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 6 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 7 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 7 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 7 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 7 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 8 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 8 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 8 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 8 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 9 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 9 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 9 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 9 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 10 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 10 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 10 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 11 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 10 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 11 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 11 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 12 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 11 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 12 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 12 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 13 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 12 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 13 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 13 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 14 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 13 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 14 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 14 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 15 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 14 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 15 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 15 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 16 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 15 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 16 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 16 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 17 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 16 times
Binary URP bridge disposed during call ./binaryurp/source/bridge.cxx:612
Changing port 2004 to 2005 18 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 17 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 17 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 19 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 17 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 18 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 18 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 20 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 18 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 19 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 19 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 21 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 19 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 20 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 20 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 22 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 20 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 21 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 21 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 23 times
This process died
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 21 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 22 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 22 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 22 times
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.odt>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 23 times
This process died
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 23 times
This process died
Unsupported URL <file:///usr/local/lib/python3.9/dist-packages/unogenerator/templates/standard.ods>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 23 times
This process died
concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.9/concurrent/futures/process.py", line 243, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/usr/local/lib/python3.9/dist-packages/unogenerator/demo.py", line 261, in demo_odt_standard
    doc=ODT_Standard(port)
  File "/usr/local/lib/python3.9/dist-packages/unogenerator/unogenerator.py", line 928, in __init__
    self.deleteAll()
  File "/usr/local/lib/python3.9/dist-packages/unogenerator/unogenerator.py", line 126, in deleteAll
    self.executeDispatch(".uno:SelectAll")
  File "/usr/local/lib/python3.9/dist-packages/unogenerator/unogenerator.py", line 131, in executeDispatch
    oDisp.executeDispatch(self.document.getCurrentController().Frame, command, "", 0, ())
AttributeError: 'ODT_Standard' object has no attribute 'document'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/unogenerator_demo", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/unogenerator/demo.py", line 66, in main
    future.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 433, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
AttributeError: 'ODT_Standard' object has no attribute 'document'

For my test.py file with the content you suggested in your previous post I got this:

root@srv:~# python3 test.py 
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 0 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 1 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 2 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 3 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 4 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 5 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 6 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 7 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 8 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 9 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 10 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 11 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 12 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 13 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 14 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 15 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2002 to 2003 16 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2003 to 2004 17 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2004 to 2005 18 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2005 to 2006 19 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2006 to 2007 20 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2007 to 2008 21 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2008 to 2009 22 times
Unsupported URL <private:factory/swriter>: "type detection failed" ./framework/source/loadenv/loadenv.cxx:190
Changing port 2009 to 2002 23 times
This process died
Traceback (most recent call last):
  File "/root/test.py", line 3, in <module>
    doc.addParagraph("Hello World", "Heading 1")
  File "/usr/local/lib/python3.9/dist-packages/unogenerator/unogenerator.py", line 260, in addParagraph
    self.cursor.setPropertyValue("ParaStyleName", style)
AttributeError: 'ODT' object has no attribute 'cursor'

So I am stuck again. I wonder what I am missing here.

Hi again

I've downloaded debian-live-11.2.0-amd64-kde.iso. Run from a usb pendrive and opened Konsole

sudo su -

apt update

apt install python3-pip

pip install unogenerator

unogenerator_start (It throws me some errors that java-vm is missing, but java-vm is not needed for UnoGenerator so I ignore them)

unogenerator_demo --create

ls -la

and files were correctly generated

I don't know where you have the problem. I don't know if you are trying to make a container of this service, but I think this is not a UnoGenerator code bug

Have you tried a headless system? I noticed you prefer a system with GUI, where some additional python libraries could be installed.

I will try with a pure Debian on a VM (not in a container) and let you know the result.

Unogenerator needs Libreoffice (UI App) but is launched with --headless parameter. UnoGenerator runs too, in console only mode, without GUI.

I tried with a local machine, yet it had the same issue. So I started from the scratch with a Debian container and it turned out that it's not only pip that needs to be installed, or core of libreoffice, one needs to install python3-uno, libreoffice-writer and libreoffice-calc as well, otherwise you will see the "Unsupported URL" error.

I could have thought of that. Anyways, this is the working Dockerfile that does the job:

FROM debian:bullseye

RUN apt-get update &&\
    apt-get -y upgrade &&\
    apt-get -y install python3-pip python3-uno &&\
    apt-get -y install libreoffice-writer libreoffice-calc &&\
    apt-get -y install openjdk-11-jre

RUN pip3 install --upgrade unogenerator

RUN unogenerator_start

ENTRYPOINT tail -f /dev/null

Although it seems to be obvious now, maybe it is worth adding to your INSTALL setup, this or any modified version you like.