Page 1 of 1

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

Posted: Tue May 28, 2019 4:52 pm
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')

Re: loadComponentFromURL or opening template extremely slow

Posted: Tue May 28, 2019 6:26 pm
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.

Re: loadComponentFromURL or opening template extremely slow

Posted: Tue May 28, 2019 6:47 pm
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!

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

Posted: Tue May 28, 2019 7:05 pm
by RoryOF
Check the version of Python it is using.

Re: Opening template extremely slow (few min.)

Posted: Tue May 28, 2019 7:11 pm
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?

Re: Opening template extremely slow (few min.)

Posted: Tue May 28, 2019 7:19 pm
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


Re: Opening template extremely slow (few min.)

Posted: Tue May 28, 2019 7:35 pm
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?

Re: Opening template extremely slow (few min.)

Posted: Tue May 28, 2019 8:31 pm
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.

Re: Opening template extremely slow (few min.)

Posted: Wed May 29, 2019 6:16 pm
by Bastien
Just reinstall every thing and it works but I didn't find the reason of this failure.