Friday, 4 September 2020

How python-uno can manipulate libreoffice-calc with pipe?

Python uno can communicate with libreoffice-calc via socket,the common way is to launch libreOffice-calc from the shell:

soffice --calc --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"

soffice can communicate python-uno with socket and port:2002.

sudo netstat -anp  |grep  soffice
tcp        0      0 127.0.0.1:2002          0.0.0.0:*               LISTEN      3115/soffice.bin    
unix  2      [ ACC ]     STREAM     LISTENING     45712    3115/soffice.bin     /tmp/OSL_PIPE_1000_SingleOfficeIPC_7fb3858dfd518f4aa054b3e7cf720
unix  3      [ ]         STREAM     CONNECTED     45702    3115/soffice.bin     
unix  3      [ ]         STREAM     CONNECTED     45716    3115/soffice.bin    

Then you can open a python shell ,import uno to manipulate calc.

Now i open an calc from menu:

enter image description here

When you start soffice from menu:

sudo netstat -anp  |grep  soffice
unix  2      [ ACC ]     STREAM     LISTENING     49386    3200/soffice.bin     /tmp/OSL_PIPE_1000_SingleOfficeIPC_7fb3858dfd518f4aa054b3e7cf720
unix  3      [ ]         STREAM     CONNECTED     49390    3200/soffice.bin     
unix  3      [ ]         STREAM     CONNECTED     48919    3200/soffice.bin  

soffice can not communicate python-uno with socket ,the port:2002 is not opened.

How can manipulate the calc with python-uno when lilbreoffice-calc started from menu?



from How python-uno can manipulate libreoffice-calc with pipe?

No comments:

Post a Comment