Can't get UID or indentifier

Asked by A

I can't seem to print out the UID from the tag.
I can get the tag object successfully but can't seem to print the UID.
Can anyone see what's wrong?

def connected(tag):
        print(tag.uid)
        return False

clf = nfc.ContactlessFrontend('tty:AMA0:pn532')
print(clf)
tag = clf.connect(rdwr={'on-connect': connected})

Traceback (most recent call last):
  File "server.py", line 27, in <module>
    tag = clf.connect(rdwr={'on-connect': connected})
  File "/home/pi/dev/toy/app/python/nfc/clf/__init__.py", line 547, in connect
    result = self._rdwr_connect(rdwr_options, terminate)
  File "/home/pi/dev/toy/app/python/nfc/clf/__init__.py", line 573, in _rdwr_connect
    if options['on-connect'](tag):
  File "server.py", line 13, in connected
    print(tag.uid)
AttributeError: 'NTAG213' object has no attribute 'uid'

Question information

Language:
English Edit question
Status:
Answered
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :
#1

Since version 0.10.0 there is a 'tag.identifier' attribute for all tag types. In case of a Type 2 Tag it contains the UID.

Can you help with this problem?

Provide an answer of your own, or ask A for more information if necessary.

To post a message you must log in.