我是Python和Basic的新手。我试图在LibreOffice(LO)Calc中复制Google Sheets的IMPORTHTML函数。简而言之,我想在Calc中创建一个GetHtmTable(Url,Table Index)基本函数,它将调用Python脚本来完成繁重的工作。在
因此,基于Villeroy的great example,我在lo5.1.6.2中实现了。基本的SOUNDEX函数调用Python脚本sheetFunctions.py来熟悉这个过程。我的环境是linuxmint18,我使用python3,我导入了各种库,如Uno、PIP等。。我使用PycharmProjects作为Python编辑器。在
我清楚地看到了localc菜单工具->宏->组织宏->python下的sheetFunctions.pypython脚本,它确实在/usr/lib/libreoffice/share/Scripts/python文件夹中。在
每当我运行SOUNDEX Basic函数时,都会看到以下错误消息:BASIC runtime error. An exception occurred Type:
com.sun.star.script.provider.ScriptFrameworkErrorException Message:
: an
error occurred during file opening
/usr/lib/libreoffice/program/pythonscript.py:429 in function
getModuleByUrl() [lastRead = self.sfa.getDateTimeModified( url )]
/usr/lib/libreoffice/program/pythonscript.py:993 in function
getScript() [mod = self.provCtx.getModuleByUrl( fileUri )]
我试着调试SOUNDEX基本函数,发现阻塞点是程序运行时getScript("vnd.sun.star.script:sheetFunctions.py$soundex?language=Python&location=user")。在
几天来我一直在努力克服这个错误,但我必须承认,没有成功。在
我想知道我是需要在基本环境中添加一些额外的扩展,还是在Linux/Python环境中缺少一个插件?在
我把location=user改为location=document,又被卡住了。我最近添加了libreoffice脚本提供程序python,这要归功于命令sudo apt-get install libreoffice-script-provider-python,但这没有帮助。我也在Calc文档中嵌入了Python脚本,但这并没有解决问题。在