xlwings quickstart创建项目点击Run Main报错:ModuleNotFoundError
xlwings运行报错:ModuleNotFoundError: No module named 'hallo_welt'
- 已完成环境配置:终端安装xlwings,添加Excel插件并在VBA工具区启用xlwings按钮
- 执行项目创建命令:
xlwings quickstart hallo_welt - 生成
hallo_welt文件夹,内含同名Python脚本与xlsm文件,但点击「Run Main」按钮时触发报错:error:Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'hallo_welt' - 所用Python代码:
import xlwings as xw def main(): wb = xw.Book.caller() sheet = wb.sheets[0] if sheet["A1"].value == "Hello xlwings!": sheet["A1"].value = "Bye xlwings!" else: sheet["A1"].value = "Hello xlwings!" if __name__ == "__main__": xw.Book("hallo_welt.xlsm").set_mock_caller() main() - 预期结果:首次点击「Run Main」时,A1单元格显示「Hello xlwings!」
内容的提问来源于stack exchange,提问作者JD089
相关产品推荐
相关产品推荐

