8 Replies Latest reply on Apr 16, 2015 6:36 PM by dng

    What is the simplest way to write to the snapshot table in python, without providing the timestamp.

    ambassallo

       Here is my python  code which errors out on the last line

       
      import win32com.client
      pi_sdk = win32com.client.Dispatch('PISDK.PISDK')
      conn = win32com.client.Dispatch('PISDKDlg.Connections')
      pi_server = pi_sdk.Servers('PIservername') # server host name, must be configured in the "known servers table"
      conn.Login(pi_server,'pidemo','password',1,0)
      pi_point = pi_server.PIPoints['testalarmpoint']
      nm = win32com.client.Dispatch('PISDKCommon.NamedValues')
      Vals = win32com.client.Dispatch('PISDK.PIValues')
      pival = win32com.client.Dispatch('PISDK.PIValue')
      pierrror = win32com.client.Dispatch('PISDKCommon.PIErrors')
      Vals.ReadOnly = False
      pival = Vals.Add('*',100,nm)
      Vals.ReadOnly = True
      pierror = pi_point.Data.UpdateValues(Vals)
      

       This is the error that I am getting

       

      >>> pierror = pi_point.Data.UpdateValues(Vals)
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<COMObject <unknown>>", line 3, in UpdateValues
      TypeError: The Python instance can not be converted to a COM object