Can't run python macro on Document open

Hi, All. I have a python macro, embended into my .ods file
My macro works well, when I start it manualy throught APSO/standard interfaces
Now I want to autorun it on document open. But on open doc I see an error
image
image

Hallo
change the signature of your »run« -function:


def run( *_ ):  
    …

Document Event-Driven Macros are called with the DocumentEvent parameter

Great, it works

anyway … on development of event-driven things in context of python you should start with NOT embedded scripts, and some »prototyp«-function for Example:

ctx = XSCRIPTCONTEXT.getComponentContext()
createUnoService = ctx.ServiceManager.createInstance
mri = createUnoService("mytools.Mri")

def _inspect_(event):
    mri.inspect(event)

in most cases you may use »event.Source.…« for doing stuff?

Embedding the script into documents and rebind of event, should be the very last step after some development-test-cycles