1

I have wrote code as below to communicate with a dll.i have registered this dll.

from ctypes import cdll
# give location of dll
mydll = cdll.LoadLibrary("C:\Windows\SysWOW64\zkemkeeper.dll")
ip = "172.16.16.70"
port = "4370"
mydll.Connect_Net(ip,port)    

I get the following error whenevr i execute it.

Traceback (most recent call last):
  File "C:\Python34\fetch.py", line 6, in <module>
    mydll.Connect_Net(ip,port)
  File "C:\Python34\lib\ctypes\__init__.py", line 364, in __getattr__
    func = self.__getitem__(name)
  File "C:\Python34\lib\ctypes\__init__.py", line 369, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'Connect_Net' not found      

Also i m able to communicate with this dll and access its function using PHP.Can anyone let me know what can be the issue and how to solve it.

2 Answers 2

1

Try this Python snippet:

from win32com.client import Dispatch
zk = Dispatch("zkemkeeper.ZKEM")
ip = "172.16.16.70"
port = "4370"
zk.Connect_Net(IP_address, port)
Sign up to request clarification or add additional context in comments.

2 Comments

You should explain why this addresses the question.
He wants to connect to ZK terminal using SDK.
0
AttributeError: function 'Connect_Net' not found      

This means that the DLL does not export a function named 'Connect_Net'. Perhaps you got the name wrong, or the DLL failed to export the function somehow.

Some other comments:

  • Using the backslash escape character is running the gauntlet. Escape the backslash, use a raw string literal, or use os.path.join.
  • Don't modify the system directories. You should put your DLL elsewhere.

2 Comments

if this function does not exist in DLL than how php is able to communicate with it and access connect_net function,Also it is no me who is copying dll in system directories its our hardware (biometric) machine provider who copies dll to system directory.
Connect_Net and connect_net are different names. With respect there is no explanation other than what appears in my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.