On Mon, 19 Dec 2005 08:58:17 -0500, [EMAIL PROTECTED] wrote:

>I am trying to use the OSISoft PI (Plant Information) API to collect data 
>about processes within our facility, however, when I try to connect to the 
>PI server using their API calls, I get the following error"
>
>  
>
>>>>>>> from ctypes import *
>>>>>>> PiAPI=windll.piapi32
>>>>>>> valid = 0
>>>>>>> status = PiAPI.piut_setservernode(servername)
>>>>>>> status = pi.piut_login("pidemo", "dorazio", valid)
>>>>        
>>>>
>Traceback (most recent call last):
>  File "<pyshell#10>", line 1, in ?
>    status = pi.piut_login("pidemo", "dorazio", valid)
>WindowsError: exception: access violation writing 0x00000000
>
>
>I THINK this means we are not licensed to make API calls against this dll, 
>but I am not sure.
>  
>

No, that's not what it means.  "Access violation" is an Intel processor 
term that mean you tried to access an invalid memory address.  It is 
also called "general protection fault".  In this particular instance, it 
tried to write to a null pointer.

What is "servername"?  What is "pi"?  Neither is defined here.  Is it 
possible that the third parameter to piut_login is an OUTPUT parameter 
-- that it is returning a "valid" state to you?  In that case, you have 
to use ctypes magic to declare that the parameter is a pointer:

  pi.piut_login( "pidemo", "dorazio", ctypes.byref( valid ) )

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to