You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Azure Runbook运行Python脚本时的ModuleNotFoundError

问题解决方法

核心原因

你在Azure Runbook里已经把FileObject类直接写在当前脚本中,但代码里仍然保留了本地跨文件使用的from Object import FileObject导入语句,导致Runbook找不到名为Object的模块。

具体解决步骤

  • 打开你的Azure Runbook脚本,找到并删除所有类似from Object import FileObject的导入代码
  • 确保脚本结构是先定义FileObject类,再使用这个类创建entitiesToProcess列表,就像你提供的Runbook示例代码那样:
    class FileObject:
        def __init__(self, name, columns, thresholds, uniqueId):
            self.name = str(name).lower()
            self.columns = columns
            self.thresholds = thresholds
            self.uniqueId = uniqueId
    
    
    entitiesToProcess = [
        FileObject('csi_fa', ['CorporateName', 'TaxVatNumber', 'Full_Address'], [0.95, 0.95, 0.90], 'UIDFac')
    ]
    
  • 保存Runbook并重新测试执行,此时脚本会直接使用当前定义的FileObject类,不会再出现模块找不到的错误。

内容的提问来源于stack exchange,提问作者Indranil Sarkar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 10:58:19