fananimi / pyzk

Unofficial library of zkteco fingerprint attendance machine
GNU General Public License v2.0
493 stars 320 forks source link

listening to real time events throws error #86

Closed frankville closed 4 years ago

frankville commented 4 years ago

Hi Describe the bug I'm trying to get real time events from a device using the test_machine.py script but the script throws an error

To Reproduce I execute the test_machine.py script with the -l option to listen to real time events but when an events arrives the script throws this error

ZK udp://192.168.1.23:4370 users[28]:178/30000 fingers:80/2200, records:65/50000 faces:0/0

--- Live Capture! (press ctrl+C to break) --- timeout 0 Process terminate : local variable 'user_id' referenced before assignment Error: <class 'UnboundLocalError'>

Traceback (most recent call last): File ".\test_machine.py", line 245, in for att in conn.live_capture():# using a generator! File "C:\soft\Workana_ZKHome\zkhome\pyzk-master\zk\base.py", line 1327, in live_capture if isinstance(user_id, int): UnboundLocalError: local variable 'user_id' referenced before assignment

Enabling device ... ok bye!

Expected behavior print the attributes of the event on console

Capture Data I leave here a link a wireshark capture where two events occur, a failed entrance attempt and a successfull entrance event https://drive.google.com/open?id=1UJgZi9NgTpHWQ6slU6i3HfBuHmqccLP8

System (please complete the following information):

Additional context

Firmware Version : Ver 6.60 Nov 7 2014 Platform : ZEM560 DeviceName : rxC9

Is there anything I can do to fix this and get the real time events? I'm currently developing a solution for one of my customers that involves ZKTeco devices and I believe this library is the most robust for the job.

Thanks

sivapraka commented 4 years ago

Hi Describe the bug I'm trying to get real time events from a device using the test_machine.py script but the script throws an error

To Reproduce I execute the test_machine.py script with the -l option to listen to real time events but when an events arrives the script throws this error

ZK udp://192.168.1.23:4370 users[28]:178/30000 fingers:80/2200, records:65/50000 faces:0/0

--- Live Capture! (press ctrl+C to break) ---

timeout 0 Process terminate : local variable 'user_id' referenced before assignment Error: <class 'UnboundLocalError'>

Traceback (most recent call last):

File ".\test_machine.py", line 245, in for att in conn.live_capture():# using a generator! File "C:\soft\Workana_ZKHome\zkhome\pyzk-master\zk\base.py", line 1327, in live_capture if isinstance(user_id, int): UnboundLocalError: local variable 'user_id' referenced before assignment Enabling device ... ok bye!

Expected behavior print the attributes of the event on console

Capture Data I leave here a link a wireshark capture where two events occur, a failed entrance attempt and a successfull entrance event https://drive.google.com/open?id=1UJgZi9NgTpHWQ6slU6i3HfBuHmqccLP8

System (please complete the following information):

  • OS: Windows 10 Pro 32 bits
  • Python version: 3.8.2

Additional context

Firmware Version : Ver 6.60 Nov 7 2014 Platform : ZEM560 DeviceName : rxC9

Is there anything I can do to fix this and get the real time events? I'm currently developing a solution for one of my customers that involves ZKTeco devices and I believe this library is the most robust for the job.

Thanks

Do you want to capture the live connection. Kindly look on #36

frankville commented 4 years ago

Hi, I tried to use the test_machine.py provided by the repo but it didn't work with that device. I had to base my work on another repo and customize it to make it work. Thanks. Closing this issue.