运行Python程序时出错:com_error: (-2147023174, 'RPC 服务器不可用。', None, None)

问题描述 投票:0回答:1

我正在使用 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 excel winapi visio win32com
1个回答
0
投票

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

  • wb = xw.Book(文件路径)
  • ws = wb.sheets['']
© www.soinside.com 2019 - 2024. All rights reserved.