C++ exceptions now propagate through python

This commit is contained in:
Ondrej Mikle 2014-07-19 15:54:57 +02:00
parent a8149abeec
commit 821f394602
3 changed files with 34 additions and 31 deletions

View file

@ -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()