[SOLVED] Session_cleanup function not working for the LibreOffice Fantastic Cartable extension
Published: April 14, 2026 - 10:41 AM
Good morning,
Some time ago, I was trying to package the "Fantastic Schoolbag" extension for LibreOffice. After some difficulty, I managed to package it and am sharing the package here in case it might be useful to someone. (This package depends on a package that installs LibreOffice.)
My problem is that the `session_cleanup()` function does not automatically uninstall the extension from user profiles after the Wapt package has been uninstalled. However, when I test the `session_cleanup()` function in PyScripter, `installed_softwares('LibreOffice')` correctly returns a list, and `run_notfatal(r'"C:\Program Files\LibreOffice\program\unopkg.exe" remove vnd.cmfpmatik.cartablefantastique') correctly uninstalls the extension from the profile.
However, if after the wapt package has been uninstalled, for a user I open a command prompt and execute the session_cleanup function:
It seems to run correctly, but the extension is not uninstalled.
Surprisingly, if I run the session_cleanup function command in a command prompt within the user's session (with user rights, not administrator privileges):
The extension uninstalls correctly here.
I don't understand where the problem is coming from. Do you have any idea?
Some time ago, I was trying to package the "Fantastic Schoolbag" extension for LibreOffice. After some difficulty, I managed to package it and am sharing the package here in case it might be useful to someone. (This package depends on a package that installs LibreOffice.)
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
r"""Pour information : installation avec unopkg.exe pour tous les utilisateurs (argument --shared) inopérante (avec LO 25.8.6)
-> utiliser unopkg.exe pour chaque utilisateur via fonction session_setup() """
source_dir=makepath('C:','cachefileWAPT','LibreOffice_extensions','Lbo_CartableFantastique_college')
def install():
#copie du dossier de l'extension en local
if not isdir(source_dir):
mkdirs(source_dir)
print(f"Copie de l'extension Cartable Fantastique dans {source_dir}")
filecopyto('Lbo_CartableFantastique_college.v5.oxt',source_dir)
print("Installation terminée avec succès")
def session_setup():
run(r'"C:\Program Files\LibreOffice\program\unopkg.exe" add --suppress-license "C:\cachefileWAPT\LibreOffice_extensions\Lbo_CartableFantastique_college\Lbo_CartableFantastique_college.v5.oxt"')
def session_cleanup():
r"""Désinstallation de l'extension dans les profils utilisateurs
Attention, pour obtenir l'id de désinstallation de l'extension utiliser unopkg.com list et non unopkg.exe list qui ne renvoie rien"""
if installed_softwares('LibreOffice'):
run_notfatal(r'"C:\Program Files\LibreOffice\program\unopkg.exe" remove vnd.cmfpmatik.cartablefantastique')
def uninstall():
print("Suppression du dossier de l'extension Cartable Fantastique")
if isdir(source_dir):
remove_tree(source_dir)
if dir_is_empty(makepath('C:','cachefileWAPT','LibreOffice_extensions')):
remove_tree(makepath('C:','cachefileWAPT','LibreOffice_extensions'))
print("Désinstallation terminée avec succès")
However, if after the wapt package has been uninstalled, for a user I open a command prompt and execute the session_cleanup function:
Code: Select all
U:\>wapt-get session-cleanup col73-libreoffice-extension-cartable-fantastique-college
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
0
U:\>
Surprisingly, if I run the session_cleanup function command in a command prompt within the user's session (with user rights, not administrator privileges):
Code: Select all
U:\>"C:\Program Files\LibreOffice\program\unopkg.exe" remove vnd.cmfpmatik.cartablefantastique
U:\>
I don't understand where the problem is coming from. Do you have any idea?