[Solved] [Python] Update a file Calc/AOO

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
usdle
Posts: 4
Joined: Mon Aug 08, 2016 7:52 pm

[Solved] [Python] Update a file Calc/AOO

Post by usdle »

Hello,
The purpose of the python script is to update a Calc file under AOO, for that I based myself on this tutorial, which after some corrections works well with LibO.
I run a python shell and type

Code: Select all

Import sys
Import os
sys.path.append('/Applications/OpenOffice.app/Contents/MacOS')
import uno
and I get this error :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/OpenOffice.app/Contents/MacOS/uno.py", line 23, in <module>
import pyuno
SystemError: dynamic module not initialized properly
What is missing?
Thanks in advance
Last edited by usdle on Tue Apr 11, 2023 4:05 pm, edited 2 times in total.
MacOS Ventura 13.3 (iMac-Intel) : AOO 4.1.14 , LibreOffice 7.3.7.2, Adoptium-temurinJDK_1.8.0_345
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Python] Update a file Calc/AOO

Post by Villeroy »

1. OpenOffice uses Python2.
2. Open/LibreOffice are distributed with their own Python runtime because Python needs to be compiled with the same compiler as the office suite. Under Linux, this is not a problem if you use the distribution's office with the distribution's Python.

Disclaimer: I do not run any Mac.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
usdle
Posts: 4
Joined: Mon Aug 08, 2016 7:52 pm

Re: [Python] Update a file Calc/AOO

Post by usdle »

Hi,
Issue resolved by replacing Python 2.7.18 with 2.7.16 which was the last version of Python provided by Apple in the Big Sur release.
MacOS Ventura 13.3 (iMac-Intel) : AOO 4.1.14 , LibreOffice 7.3.7.2, Adoptium-temurinJDK_1.8.0_345
Post Reply