Das Dokument erscheint wie gewünscht als 'Unbenannt 1', allerdings mit folgender Fehlermeldung:
Ich vermute, es liegt daran, wie ich die Scripte in den Pythonpfad einbinde:Meldung: <class 'uno.com.sun.star.uno.RuntimeException'>: Couldn't convert file url to a system path for reason (21)
/opt/openoffice4/program/uno.py:92 in function fileUrlToSystemPath() [return pyuno.fileUrlToSystemPath( url )]
vnd.sun.star.tdoc:/1/Scripts/python/tasks.py:19 in function <module>() [None]
/opt/openoffice4/program/pythonscript.py:450 in function getModuleByUrl() [exec(code, entry.module.__dict__)]
/opt/openoffice4/program/pythonscript.py:991 in function getScript() [mod=self.provCtx.getModuleByUrl( fileUri )]
Code: Alles auswählen
import uno
import sys
doc = XSCRIPTCONTEXT.getDocument()
pythonPath = uno.fileUrlToSystemPath(doc.URL) + '/Scripts/python'
if pythonPath not in sys.path: sys.path.append(pythonPath)
Schöne Grüße
Volker