bytearray index out of range error in the dev-tags branch

Asked by Nick Ludlam on 2015-02-03

I'm getting the occasional exception when running "tagtool show" in your dev-tags branch. I don't know if this is a known issue, but wanted to flag it up anyway.

test@nfc-test:~/NFC/dev-tags$ python examples/tagtool.py show
[nfc.clf] searching for reader with path 'usb'
[nfc.clf] using SCM Micro SCL3711-NFC&RW PN533v2.7 at usb:001:017
** waiting for a tag **
Type2Tag 'NXP NTAG203' ID=0438ADE2463480 ATQ=4400 SAK=00
Traceback (most recent call last):
  File "examples/tagtool.py", line 571, in <module>
    TagTool().run()
  File "/home/test/NFC/dev-tags/examples/cli.py", line 283, in run
    while self.run_once() and self.options.loop:
  File "/home/test/NFC/dev-tags/examples/cli.py", line 278, in run_once
    return clf.connect(**kwargs)
  File "/home/test/NFC/dev-tags/nfc/clf.py", line 404, in connect
    result = self._rdwr_connect(rdwr_options, terminate)
  File "/home/test/NFC/dev-tags/nfc/clf.py", line 424, in _rdwr_connect
    if callback and callback(tag):
  File "examples/tagtool.py", line 308, in on_rdwr_connect
    self.rdwr_commands[self.options.command](tag)
  File "examples/tagtool.py", line 329, in show_tag
    if tag.ndef:
  File "/home/test/NFC/dev-tags/nfc/tag/__init__.py", line 217, in ndef
    if ndef.has_changed:
  File "/home/test/NFC/dev-tags/nfc/tag/__init__.py", line 135, in has_changed
    old_data, self._data = self._data, self._read_ndef_data()
  File "/home/test/NFC/dev-tags/nfc/tag/tt2.py", line 141, in _read_ndef_data
    if self._read_capability_data(tag_memory) == False:
  File "/home/test/NFC/dev-tags/nfc/tag/tt2.py", line 125, in _read_capability_data
    if tag_memory[12] != 0xE1:
  File "/home/test/NFC/dev-tags/nfc/tag/tt2.py", line 612, in __getitem__
    return self._data_in_cache[key]
IndexError: bytearray index out of range

Question information

Language:
English Edit question
Status:
Answered
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Last query:
2015-02-03
Last reply:
2015-02-11

This is solved with revison 360 on branch dev-tags. Thanks for reporting.

Can you help with this problem?

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

To post a message you must log in.