【问题标题】:Error when running Python Program: com_error: (-2147023174, 'The RPC server is unavailable.', None, None)运行 Python 程序时出错:com_error: (-2147023174, 'RPC 服务器不可用。', None, None)
【发布时间】:2019-12-04 02:52:37
【问题描述】:

我正在使用 Excel、Python 和 Visio,当我运行这个简单的代码时,我收到一个错误

com_error: (-2147023174, 'The RPC server is unavailable.', None, None)

这是我正在运行的代码:

for row in range(1,sheet3.nrows):
    if sheet3.cell_value(row,13) == "":
        continue
    if currentDate in dateList:
        x1 = sheet3.cell_value(row,14)
        x2 = sheet3.cell_value(row,15)
        y1 = sheet3.cell_value(row,16)
        y2 = sheet3.cell_value(row,17)
        x1new = x1 - .4
        x2new = x2 - .4
        borderColor = 0
        borderType = 0
        colorValue = sheet3.cell_value(9,10)
        colorFunc(x1new,y1,x2new,y2)
        shape.Cells('FillforegndTrans').FormulaU = sheet3.cell_value(7,10)

有人知道解决这个问题的方法吗?

【问题讨论】:

  • 尝试从代码底部注释掉行并向上工作,看看哪一行产生了错误。
  • 这不需要修复。这是非常常见的内部异常。这不会停止程序执行,因为在内部处理
  • 我所要做的就是关闭 Python 并重新启动它,它现在可以正常工作了。我们知道为什么会出现这个错误吗?
  • @spaceprogramchic - 这(0x6ba)不是你的错误,也不是致命错误。窗户很常见。忽略这个。
  • 代码是在服务上下文下运行,还是在交互式会话中运行?

标签: python excel winapi visio win32com


【解决方案1】:

我绝对是个新手,但是当我使用的工作簿没有打开时,我经常遇到这个问题。重新运行整个代码,特别是以下部分似乎可以解决问题:

  • wb = xw.Book(文件路径)
  • ws = wb.sheets['']

【讨论】:

    猜你喜欢
    • 2019-07-31
    • 1970-01-01
    • 1970-01-01
    • 2021-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多