Search code examples
pythonbiometrics

AttributeError: 'module' object has no attribute 'ZKLib'


I'm trying to connect to biometric device. I have installed 'Zklib' using (Pip). My code as follows

`import sys
 import zklib
 import time
 from zklib import zkconst
 zk = zklib.ZKLib("192.168.0.188", 4370)
 ret = zk.connect()
 print "connection:", ret`

When I execute this, I get an error

AttributeError: 'module' object has no attribute 'ZKLib'

Help me to run this code successfully.


Solution

  • Try the following instead:

    import sys
    import time
    from zklib import zklib, zkconst
    
    zk = zklib.ZKLib("192.168.0.188", 4370)
    ret = zk.connect()
    print "connection:", ret
    

    The ZKlib class is in zklib.zklib not zklib. It appears that there is a typo in the Getting Started section of their GitHub page (or they expect you to be in the zklib directory when running your code?).