Forum Discussion

RajeshVV's avatar
RajeshVV
Contributor
5 years ago
Solved

Python external libraries and when any external methods are called, TC falls into infinite loop

Hi,

 

I tried using OpenPyxl and then when I'm trying to run certain methods and for handling excel values.

This happens for very first time, and when we rerun the same script to run after the first successful result,  TC doesn't execute and doesn't respond, have to kill it from task manager to run it again

Sample Script used is

 

 

def ExcelWriteSingleCell(Sheet,Cell,Value):
 excelPath = "path"
 wb = openpyxl.load_workbook(excelPath )
 ws = wb.get_sheet_by_name(Sheet)
 mycell=ws[Cell]
 mycell.value = Value

 

 

running the above method once will result properly, whereas rerunning the same will result in infinite loop state or TC not responding state

 

 

def testExcel():
  Log.Message(ExcelReadSingleCell("Sheet1", "D3"))
  Log.Message(ExcelReadSingleCell("Sheet1", "D4"))
  Log.Message(ExcelReadSingleCell("Sheet1", "D5"))
  Log.Message(ExcelReadSingleCell("Sheet1", "C3"))
  Log.Message(ExcelReadSingleCell("Sheet1", "C5"))