I'm writing a Python script, trying to access all Basic modules from files
in a directory.
In most cases I get a WrappedTargetException accessing the module(s) from a
Basic library [line: txt = one_lib.getByName(m)] ... approx. 30% of modules
are retrieved and printed.
"xdoc" is reference to a Writer/Calc document, opened hidden within a
function and returned from there, if this matters.
What's wrong?
Code: Select all
if xdoc:
log.debug('have document')
libs = xdoc.BasicLibraries
else:
log.debug('no libs found')
libs = None
if libs and libs.hasElements():
insert_text(text, cursor, 'Heading 2', name)
for lib in libs.ElementNames:
one_lib = libs.getByName(lib)
if one_lib.hasElements():
for m in one_lib.ElementNames:
try:
insert_text(text, cursor, stylename='Heading 3', s=m)
txt = one_lib.getByName(m)
insert_text(text, cursor, s=txt)
except WrappedTargetException:
insert_text(text, cursor, s='FEHLER BEIM LESEN')