Python script unable to print to console in libreoffice-gtk3

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.

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

Hi

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.