9 Replies Latest reply on Jul 11, 2018 6:58 PM by tomaszpoplawski

    Update values from Python to AF

    tomaszpoplawski

      Hello,

       

      i'm trying to send data from Python to AF via PI Web API Client Python (https://github.com/osimloeff/PI-Web-API-Client-Python).

      When the row is called:

      client.streamSet.update_values_ad_hoc_with_http_info(streamValues)
      

       

      the following error appears:

      AttributeError: 'numpy.int32' object has no attribute 'swagger_types'
      

       

      My code:

           czas_do_pi = datetime.now()
      
           x = {}
           cData = pd.DataFrame(data=x)
           cData['Months'] = np.arange(1, 101, 1)
           point1 = client.point.get_by_path("\\\\PISRVT\\Months_Python")
           webIds = list()
           webIds.append(point1.web_id)
           streamValue1 = PIStreamValues()
              for i in range(0, 100):
                  timestamp = czas_do_pi + dt.timedelta(0, 0, i)
                  value1 = PITimedValue(timestamp=timestamp, value=cData['Months'][i])
                  streamValue1.web_id = point1.web_id
                  values1 = list()
                  values1.append(value1)
                  streamValue1.items = values1
                  streamValues = list()
                  streamValues.append(streamValue1)
      
        client.streamSet.update_values_ad_hoc_with_http_info(streamValues)
      

       

      Any ideas what im doing wrong?