3

I am working with Excel, Python, and Visio and when I run this simple code, I get an error of

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

This is the code I am running:

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)

Does anyone know of a way to fix this?

  • Try commenting out lines from the bottom of your code and working upwards and see which line generates the error. – Paul Herber Jul 25 '19 at 19:05
  • this not need to be fix. this is very common internal excetion. this not stop program execution, because handled internally – RbMm Jul 25 '19 at 19:06
  • All I had to do was close out of Python and restart it, and it works perfectly fine now. Do we know why this error occurs? – spaceprogramchic Jul 25 '19 at 19:13
  • @spaceprogramchic - this (0x6ba) not is your error and not fatal error at all. very common for windows. ignore this. – RbMm Jul 25 '19 at 19:20
  • Is the code running under a service context, or is it running in an interactive session? – IInspectable Jul 26 '19 at 09:31

1 Answers1

0

I'm by every means a complete novice but I often run into this issue when the Workbook I'm using isn't open. Re-running the entire code, specifically the following part seems to solve the issue:

  • wb = xw.Book(filepath)
  • ws = wb.sheets['']