diff --git a/source/text/sbasic/python/python_import.xhp b/source/text/sbasic/python/python_import.xhp index 1374561526..8eec99e20a 100644 --- a/source/text/sbasic/python/python_import.xhp +++ b/source/text/sbasic/python/python_import.xhp @@ -90,12 +90,14 @@ return (module_name in sys.modules.keys()) def isLoadedLibrary(lib_name: str) -> bool: """ Check PYTHON_PATH content """ - return (lib_name in sys.path) + url = uno.fileUrlToSystemPath( + f'{doc.URL}/Scripts/python/{lib_name}' ) + return (url in sys.path) def loadLibrary(lib_name: str, module_name=None): """ add directory to PYTHON_PATH, import named module """ doc = XSCRIPTCONTEXT.getDocument() url = uno.fileUrlToSystemPath( - '{}/{}'.format(doc.URL,'Scripts/python/'+lib_name)) + f'{doc.URL}/Scripts/python/{lib_name}' ) if not url in sys.path: sys.path.insert(0, url) if module_name and not module_name in sys.modules.keys(): @@ -104,7 +106,7 @@ """ remove directory from PYTHON_PATH """ doc = XSCRIPTCONTEXT.getDocument() url = uno.fileUrlToSystemPath( - '{}/{}'.format(doc.URL,'Scripts/python/ '+lib_name)) + f'{doc.URL}/Scripts/python/{lib_name}' ) sys.path.remove(url) g_exportedScripts = (OnDocPostOpenLoadPython, OnDocQueryCloseUnloadPython)