unoconv / unoserver

MIT License
596 stars 81 forks source link

Troubleshooting unoconvert Network Connection Error on Ubuntu 22.04 with Python 3.10 and LibreOffice 7.3.7.2 in a Closed Network Environment #95

Closed garamssi closed 10 months ago

garamssi commented 1 year ago

Traceback (most recent call last): File "/usr/local/bin/unoconvert", line 8, in sys.exit(converter_main()) File "/usr/local/lib/python3.10/dist-packages/unoserver/client.py", line 248, in converter_main result = client.convert( File "/usr/local/lib/python3.10/dist-packages/unoserver/client.py", line 87, in convert result = proxy.convert( File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in call return self.send(self.name, args) File "/usr/lib/python3.10/xmlrpc/client.py", line 1464, in request response = self.transport.request( File "/usr/lib/python3.10/xmlrpc/client.py", line 1166, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib/python3.10/xmlrpc/client.py", line 1178, in single_request http_conn = self.send_request(host, handler, request_body, verbose) File "/usr/lib/python3.10/xmlrpc/client.py", line 1291, in send_request self.send_content(connection, request_body) File "/usr/lib/python3.10/xmlrpc/client.py", line 1321, in send_content connection.endheaders(request_body) File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/usr/lib/python3.10/http/client.py", line 976, in send self.connect() File "/usr/lib/python3.10/http/client.py", line 942, in connect self.sock = self._create_connection( File "/usr/lib/python3.10/socket.py", line 845, in create_connection raise err File "/usr/lib/python3.10/socket.py", line 833, in create_connection sock.connect(sa)

I got a this message, what should I check? Please help me.

tried cmd : unoconvert --convert-to pdf target.docx result.pdf ubuntu 22.04 LTS python 3.10 LibreOffice 7.3.7.2 30 ** closed network

regebro commented 1 year ago

Did you start the unoserver first? Otherwise you will get an error there: ConnectionRefusedError: [Errno 111] Connection refused

garamssi commented 1 year ago

Did you start the unoserver first? Otherwise you will get an error there: ConnectionRefusedError: [Errno 111] Connection refused

root@thumbnail:~# ls -l total 2664 -rw-r--r-- 1 root root 12309 Nov 10 02:48 aaa.docx -rw-r--r-- 1 root root 5433 Nov 13 07:35 aaa.pdf -rw-r--r-- 1 root root 12513 Nov 22 01:37 box.docx -rw-r--r-- 1 root root 12270 Nov 13 07:39 error.docx -rw-r--r-- 1 root root 4792 Nov 13 07:39 error.pdf -rw-r--r-- 1 root root 2156 Nov 13 06:25 find_uno.py -rw-r--r-- 1 root root 2632263 Oct 21 11:30 get-pip.py -rw-r--r-- 1 root root 12309 Nov 10 05:49 please.docx -rw-r--r-- 1 root root 5433 Nov 13 07:35 please.pdf drwx------ 3 root root 4096 Nov 6 06:26 snap root@thumbnail:~# unoconvert --convert-to pdf box.docx box.pdf Traceback (most recent call last): File "/usr/local/bin/unoconvert", line 8, in <module> sys.exit(converter_main()) File "/usr/local/lib/python3.10/dist-packages/unoserver/client.py", line 248, in converter_main result = client.convert( File "/usr/local/lib/python3.10/dist-packages/unoserver/client.py", line 87, i n convert result = proxy.convert( File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__ return self.__send(self.__name, args) File "/usr/lib/python3.10/xmlrpc/client.py", line 1464, in __request response = self.__transport.request( File "/usr/lib/python3.10/xmlrpc/client.py", line 1166, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib/python3.10/xmlrpc/client.py", line 1178, in single_request http_conn = self.send_request(host, handler, request_body, verbose) File "/usr/lib/python3.10/xmlrpc/client.py", line 1291, in send_request self.send_content(connection, request_body) File "/usr/lib/python3.10/xmlrpc/client.py", line 1321, in send_content connection.endheaders(request_body) File "/usr/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/usr/lib/python3.10/http/client.py", line 976, in send self.connect() File "/usr/lib/python3.10/http/client.py", line 942, in connect self.sock = self._create_connection( File "/usr/lib/python3.10/socket.py", line 845, in create_connection raise err File "/usr/lib/python3.10/socket.py", line 833, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused root@thumbnail:~# ps -ef | grep uno root 49499 1 0 Nov20 ? 00:00:07 /usr/bin/python3 /usr/local/ bin/unoserver root 53360 53184 0 01:39 pts/4 00:00:00 grep --color=auto uno

  1. start first command "unoserver &"
  2. try convert command "unoconvert convert-to pdf {targetFile} {resultFile}
  3. got an error message
garamssi commented 1 year ago

when I kill all processes related to unoserver and try again, it works. But I don't know the difference between it working and not working. I'm trying to start unoserver as a background process all the time. So I'm running it with a & after the command. What should I do?

regebro commented 1 year ago

Try opening unoserver in a separate terminal and see what output it gives you, maybe it shows some error message after a while?

garamssi commented 1 year ago

Thank you for your kindness. You have been a great help to me, thank you. Thank you so much for making this open source.

regebro commented 10 months ago

Did you resolve it?

garamssi commented 10 months ago

Yes, thank you, it has been resolved well