https://bugs.documentfoundation.org/show_bug.cgi?id=146498

            Bug ID: 146498
           Summary: Python user macros do not refresh when code is edited
                    in an imported module
           Product: LibreOffice
           Version: 7.2.4.1 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
If I create a python macro in the user scripts directory that imports codefrom
another module, the first time it is run I get the expected result.

However if I modify the referenced module's code the "old" code still runs;
even if I delete the __pycache__ directory between running. I assume the code
is being cached elsewhere?



Steps to Reproduce:
1. create a python file ~/config/libreoffice/4/user/Scripts/python/testmacro.py

import anothermodule

def set_some_text():
    doc = XSCRIPTCONTEXT.getDocument()
    oSheets = doc.getSheets()
    sSheet = doc.getCurrentController().getActiveSheet()
    activeCell = doc.getCurrentSelection()
    activeCell.setString(anothermodule.get_something())

2. create a python file
~/config/libreoffice/4/user/Scripts/python/pythonpath/anothermodule.py

def get_something():
    return "A"

3. Open Calc and run the macro "set_some_text". The letter A should appear.

4. Modify the anothermodule.py file and change to:

def get_something():
    return "B"

5. Open Calc and run the macro "set_some_text". I would expect the letter "B"
to appear but it will instead set the cell to "A" still.





Actual Results:
"A" is set in the ActiveCell after changing anothermodule.py

Expected Results:
"B" is set in the ActiveCell


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version: 7.2.4.1
Build ID: 20(Build:1)
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to