-
Notifications
You must be signed in to change notification settings - Fork 0
/
fp_delete.py
44 lines (31 loc) · 1.09 KB
/
fp_delete.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PyFingerprint
Copyright (C) 2015 Bastian Raschke <[email protected]>
All rights reserved.
"""
from pyfingerprint.pyfingerprint import PyFingerprint
## Deletes a finger from sensor
##
## Tries to initialize the sensor
try:
f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)
if ( f.verifyPassword() == False ):
raise ValueError('The given fingerprint sensor password is wrong!')
except Exception as e:
print('The fingerprint sensor could not be initialized!')
print('Exception message: ' + str(e))
exit(1)
## Gets some sensor information
print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))
## Tries to delete the template of the finger
try:
positionNumber = input('Please enter the template position you want to delete: ')
positionNumber = int(positionNumber)
if ( f.deleteTemplate(positionNumber) == True ):
print('Template deleted!')
except Exception as e:
print('Operation failed!')
print('Exception message: ' + str(e))
exit(1)