This is about automation of LO Base using Python macros.
Please see this question in the LO forum posed by me yesterday.
As you can see, from the link in my second post, it is trivial to open a form on the OpenDocument event, i.e. when the file is opened, if you use a VisualBasic macro.
However, attempts to open a form programmatically using Python macros always seem to lead to WrappedTargetException. e.g.:
def open_contacts_form(e):
odb = e.Source
container = odb.FormDocuments
obj = container.getByHierarchicalName('kernel.contacts')
obj.open() # causes the WrappedTargetException
But I can't find out how to access the initial (target) exception. I printed out (to a file) dir(e), and I don't see the attributes I expect to find from the API page for WrappedTargetException, such as TargetException, etc.
I have a suspicion unorthodox thread use could be causing the problem. But I don't understand how to dig into WrappedTargetException for greater enlightenment.
To dig into
WrappedTargetException, catch the exception and use an introspection tool such as MRI.(I did not test this code.)
For further information, including the link for downloading MRI, see Need some explanation about interface in LibreOffice basic.