We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Python script unable to print to console in libreoffice-gtk3

asked 2017-09-26 21:36:48 +0200

kfs.2 gravatar image

updated 2021-05-25 21:53:11 +0200

Alex Kemp gravatar image

I have a Python 3 script for Calc that prints information to the console, and the printed output is visible in the console if LO was launched from the command line. If LO is launched from the GUI, the script still executes correctly but the information printed to the console is (obviously) not visible. The scripts have functioned well ever since LO supported Python 2.

After updating to Ubuntu 17.04, which apparently defaults to libreoffice-gtk3, I now get an error message about an Input/Output error when the Python script attempts to print. If I remove all the print statements from the Python script, the script executes successfully and without any messages.

If I uninstall libreoffice-gtk3 and install libreoffice-gtk (which uses gtk2), then LO executes the script correctly, with or without the print statements in the script.

If there is a fix to this (using gtk3), I'd love to hear it. Otherwise, I just wanted to share this information in case it portends a deeper issue.

edit retag flag offensive close merge delete


Is much better, if you show you code and error that you get. LO version too.

mauricio gravatar imagemauricio ( 2020-09-16 19:09:38 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-09-16 14:34:04 +0200


You can get extra information from Input/Output to Screen with Python wiki page. However your Python script will somehow need to identify the runtime context, which means being able to distinguish the shell from libO GUI, if you want your script to run in both contexts.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2017-09-26 21:36:48 +0200

Seen: 166 times

Last updated: Sep 16 '20