mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-08 16:36:25 +02:00
C++ exceptions now propagate through python
This commit is contained in:
parent
a8149abeec
commit
821f394602
3 changed files with 34 additions and 31 deletions
21
runme.py
21
runme.py
|
@ -1,12 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
from brmdoor_nfc import NFCDevice
|
||||
from brmdoor_nfc import NFCDevice, NFCError
|
||||
from binascii import hexlify
|
||||
|
||||
nfc = NFCDevice()
|
||||
nfc.close()
|
||||
nfc.open()
|
||||
print hexlify(nfc.scanUID())
|
||||
print "Device is opened:", nfc.opened()
|
||||
print "Closing device"
|
||||
nfc.close()
|
||||
print "Device is opened:", nfc.opened()
|
||||
try:
|
||||
nfc = NFCDevice()
|
||||
nfc.close()
|
||||
nfc.open()
|
||||
print hexlify(nfc.scanUID())
|
||||
print "Device is opened:", nfc.opened()
|
||||
print "Closing device"
|
||||
nfc.close()
|
||||
print "Device is opened:", nfc.opened()
|
||||
except NFCError, e:
|
||||
print "Reading UID failed:", e.what()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue