Forum Discussion

sunrays123's avatar
sunrays123
Occasional Contributor
6 years ago

Error '<' not supported between instances of 'int' and 'IDispatch Wrapper AnyUsageStub'

def verify_csv_parameters(csvFile=None):
  """
  Validate the csv parameters of specified file or saved file with ui nrt parameters
  """
  global nrtDict
  nrtDict = dict()
  ignoredlist = []
  greyOutValuesList = []
  global csvFileDict
  csvFileDict = dict()
  bResult = False
  failureCount = 0
  
  try:
    # Read from Testconfiguration.ini file.
    config = test_configuration.getTestConfiguration()
    global implantType
    implantType = config.getImplantType()  
    fileHandler = file_manager.geFileHandler()
    
    if not csvFile:
      nrtfilePath = fileHandler.getNrtFilePath()
    else:
      nrtfilePath = os.path.join(supported_functions.getExportedFileFolderPath(), csvFile)
    
    global_objects.mainForm = global_objects.custom_Sound_EP.FormMain
    global_objects.mainForm.applicationPanels.PanelNRTProgramDetails.panelWorkarea.tabControl.ClickTab("Explorer View")
    grid = global_objects.mainForm.applicationPanels.PanelNRTProgramDetails.panelWorkarea.tabControl.tabPageExplorerView.panelExplorerView.dataGridNeuralResponses
  
    rowIndex = 0
    while rowIndex < grid.DataSource.Count:
      dataGridRows = grid.dataGridRows_2
      dataGridRows.OleValue[rowIndex].Selected = True
      dataGridRows.OleValue[grid.CurrentRowIndex].Selected = False
      grid.CurrentRowIndex = rowIndex
      grid.Select_3(rowIndex)
      bounds = grid.Bounds
      grid.Click(bounds.Left + bounds.Width / 2, bounds.Top + bounds.Height / 2)
      global_objects.custom_Sound_EP.FormMain.applicationPanels.PanelNRTProgramDetails.BarDockControl.DockedBarControl.ClickItem("Edit")
  
      nrtDict, greyOutValuesList = NRTParameters()
    
      for key,val in nrtDict.items():
        Log.Message('GUI==>{0} = {1}' .format(key,val))
    
      nrtFileName = os.path.basename(nrtfilePath)
      Log.Message('Validating CSV File ' + nrtFileName)
      csvFileDict = populateCSVParameters(rowIndex, nrtfilePath)   

      ignoredlist = ignoredParameterList()
      #Log.Message(len(ignoredlist))

      if "Acoustic" in nrtFileName:
        result = validateCSVParameters_Acoustic()
        failureCount += 1 if result is False else 0

      for csvkey, csvval in csvFileDict.items():
        mappedCSVKey = getMappedCsvKey(csvkey)
        mappedCSVValue = removeUnits(getMappedCsvValue(csvval))

        if mappedCSVKey == constants.NRT_NR_SAMPLES:
          mappedCSVValue = getConvertedNrOfSamples(mappedCSVValue)

        if mappedCSVKey == constants.NRT_DELAY and mappedCSVKey in nrtDict:  
          if StrToInt(mappedCSVValue) - 10 <= StrToInt(nrtDict[mappedCSVKey]) or  StrToInt(nrtDict[mappedCSVKey]) <= StrToInt(mappedCSVValue) + 10:
            Log.Message('Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue))
          else:
            Log.Message('Not Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue))
        else:
          if mappedCSVKey in nrtDict and mappedCSVValue == nrtDict[mappedCSVKey]:
            Log.Message('Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue))
          elif mappedCSVKey in ignoredlist or mappedCSVKey in greyOutValuesList:
            continue
          else:
            Log.Message('Not Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue))
            failureCount += 1

      rowIndex += 1  
      bResult = False if failureCount > 0 else True
      
  except Exception as e:
    Log.Error(__name__ + " error!! " + str(e)) 
    bResult = False
    
  finally:
    return bResult

Getting an error '<' not supported between instances of 'int' and 'IDispatch Wrapper AnyUsageStub'. I am unable to understand the error.

 

Any anyone help on this? 

1 Reply

  • baxatob's avatar
    baxatob
    Community Hero

    Looks like some method in your code returns the value of unexpected type in the place, where you try to use < operator.

    What exact string of code produces this error?