[Solved] Opening template extremely slow (few min.)

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Bastien
Posts: 61
Joined: Mon May 12, 2014 2:45 pm

[Solved] Opening template extremely slow (few min.)

Post by Bastien »

Hello,
I'm a bit confused, all my clients are complaining about a macro that doesn't work anymore. I've tested and they're right. Any idea why these lines doesn't work anymore ?

Code: Select all

def transcription2calc(*args):
    path = 'file:///home/bastien/Bureau/toto.ott'
    args = (PropertyValue('Hidden', 0, False, 0),)
    desktop = XSCRIPTCONTEXT.getDesktop()
    desktop.loadComponentFromURL(path, "_default", 0, args)
I precise that I can no more open a template file .ott.

Clients that haven't upgraded their ubuntu session haven't this bug. I have this bug on Ubuntu 19.04 and LO 6.2.3

EDIT: I just realize that 10 mins later it has open the template (wich BTW contains only the string 'toto')
Last edited by Hagar Delest on Wed May 29, 2019 9:33 pm, edited 4 times in total.
Reason: tagged solved
LibreOffice 6.2.3.2 on Ubuntu 19.04
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: loadComponentFromURL or opening template extremely slow

Post by RoryOF »

My notes indicate that /Tools /Options /Macros /Organise Macros /OpenOffice Basic /OpenOffice Macros : ImportWizard is a set of macros that converst from older OO formats to the more modern ones.

I cannot offer any help with this, other than to indicate that this set of macros exists; I do not know how effective they are.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Bastien
Posts: 61
Joined: Mon May 12, 2014 2:45 pm

Re: loadComponentFromURL or opening template extremely slow

Post by Bastien »

Hopefully I found a solution, quite radical.

Code: Select all

apt --purge libreoffice*
apt --clean
apt --autoclean
apt --autoremove
and a complete reinstall did the trick!
Last edited by Bastien on Tue May 28, 2019 7:09 pm, edited 1 time in total.
LibreOffice 6.2.3.2 on Ubuntu 19.04
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved Opening template extremely slow (few min.)

Post by RoryOF »

Check the version of Python it is using.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Bastien
Posts: 61
Joined: Mon May 12, 2014 2:45 pm

Re: Opening template extremely slow (few min.)

Post by Bastien »

Error, it is slow again after one first normal opening. Now it keeps beeing slow (more than 5 minutes) to open a very small file.

How do you check the python it uses?
LibreOffice 6.2.3.2 on Ubuntu 19.04
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Opening template extremely slow (few min.)

Post by RoryOF »

This macro, which I found with a quick search, claims to show the OO Python version; tyhere may be (probably are) other methods

Code: Select all

# Print Python Version used for the LibreOffice pyUNO scripting framework

def PrintPythonVersion( ):
    """Print the version of python"""

    import sys

#get the doc from the scripting context which is made available to all scripts
    model = XSCRIPTCONTEXT.getDocument()
#get the XText interface
    text = model.Text
#create an XTextRange at the end of the document
    tRange = text.End
#and set the string    
    tRange.String = "python version:\n " + sys.version
    return None

Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Bastien
Posts: 61
Joined: Mon May 12, 2014 2:45 pm

Re: Opening template extremely slow (few min.)

Post by Bastien »

I got the :

python version:
3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0]

which works fine on an other machine.

The DEBUG output hangs on :

Tue May 28 19:39:05 2019 [DEBUG] PythonScript.invoke (0,)
Tue May 28 19:41:58 2019 [DEBUG] PythonScript.invoke ret = None

What does it mean?
LibreOffice 6.2.3.2 on Ubuntu 19.04
Bastien
Posts: 61
Joined: Mon May 12, 2014 2:45 pm

Re: Opening template extremely slow (few min.)

Post by Bastien »

Anyway, this problem is not related to the python script above. Libreoffice hangs on opening a simple template, whatever template it is. I really have no clue to debug this.
LibreOffice 6.2.3.2 on Ubuntu 19.04
Bastien
Posts: 61
Joined: Mon May 12, 2014 2:45 pm

Re: Opening template extremely slow (few min.)

Post by Bastien »

Just reinstall every thing and it works but I didn't find the reason of this failure.
LibreOffice 6.2.3.2 on Ubuntu 19.04
Post Reply