I'm running into similar issues. I have the following:
- Raspberry Pi
- pyusb 1.0.0b2
- Python 2.7.3 (default, Mar 18 2014, 05:13:23)
- Using ACR-122U-A9 NFC reader
When running python check I get this:
>>> import struct
>>> struct.unpack("<I", "\x0A\x00\x00\x00")
(10,)
>>> struct.unpack("<I", bytearray("\x0A\x00\x00\x00"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: unpack requires a string argument of length 4
Here is the output from tag tool.py
pi@bmipi1 ~/Downloads/nfcpy/examples $ sudo python tagtool.py -d nfc
[main] enable debug output for module 'nfc'
[nfc.clf] searching for reader with path 'usb'
[nfc.dev.transport] using pyusb version 1.x
[nfc.dev.transport] path matches '^(usb|)$'
[nfc.dev] trying usb:072f:2200
[nfc.dev] import nfc.dev.acr122
Traceback (most recent call last):
File "tagtool.py", line 516, in <module>
TagTool().run()
File "/home/pi/Downloads/nfcpy/examples/cli.py", line 283, in run
while self.run_once() and self.options.loop:
File "/home/pi/Downloads/nfcpy/examples/cli.py", line 230, in run_once
try: clf = nfc.ContactlessFrontend(device)
File "/home/pi/Downloads/nfcpy/nfc/clf.py", line 105, in __init__
if path and not self.open(path):
File "/home/pi/Downloads/nfcpy/nfc/clf.py", line 156, in open
self.dev = nfc.dev.connect(path)
File "/home/pi/Downloads/nfcpy/nfc/dev/__init__.py", line 63, in connect
usb = transport.USB(bus, dev)
File "/home/pi/Downloads/nfcpy/nfc/dev/transport.py", line 207, in __init__
self.open(bus_id, dev_id)
File "/home/pi/Downloads/nfcpy/nfc/dev/transport.py", line 275, in _PYUSB1_open
self.usb_out.write('')
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 349, in write
return self.device.write(self, data, timeout)
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 870, in write
intf, ep = self._ctx.setup_request(self, endpoint)
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 190, in setup_request
self.managed_claim_interface(device, intf)
File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 146, in managed_claim_interface
self.backend.claim_interface(self.handle, i)
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 747, in claim_interface
_check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 552, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 541, in _strerror
return _lib.libusb_strerror(errcode).decode('utf8')
File "/usr/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/arm-linux-gnueabihf/libusb-1.0.so.0: undefined symbol: libusb_strerror
I'm running into similar issues. I have the following:
- Raspberry Pi
- pyusb 1.0.0b2
- Python 2.7.3 (default, Mar 18 2014, 05:13:23)
- Using ACR-122U-A9 NFC reader
When running python check I get this: "\x0A\x00\ x00\x00" ))
>>> import struct
>>> struct.unpack("<I", "\x0A\x00\x00\x00")
(10,)
>>> struct.unpack("<I", bytearray(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: unpack requires a string argument of length 4
Here is the output from tag tool.py
pi@bmipi1 ~/Downloads/ nfcpy/examples $ sudo python tagtool.py -d nfc pi/Downloads/ nfcpy/examples/ cli.py" , line 283, in run pi/Downloads/ nfcpy/examples/ cli.py" , line 230, in run_once Frontend( device) pi/Downloads/ nfcpy/nfc/ clf.py" , line 105, in __init__ pi/Downloads/ nfcpy/nfc/ clf.py" , line 156, in open connect( path) pi/Downloads/ nfcpy/nfc/ dev/__init_ _.py", line 63, in connect pi/Downloads/ nfcpy/nfc/ dev/transport. py", line 207, in __init__ open(bus_ id, dev_id) pi/Downloads/ nfcpy/nfc/ dev/transport. py", line 275, in _PYUSB1_open usb_out. write(' ') lib/python2. 7/dist- packages/ usb/core. py", line 349, in write write(self, data, timeout) lib/python2. 7/dist- packages/ usb/core. py", line 870, in write setup_request( self, endpoint) lib/python2. 7/dist- packages/ usb/core. py", line 190, in setup_request managed_ claim_interface (device, intf) lib/python2. 7/dist- packages/ usb/core. py", line 146, in managed_ claim_interface backend. claim_interface (self.handle, i) lib/python2. 7/dist- packages/ usb/backend/ libusb1. py", line 747, in claim_interface self.lib. libusb_ claim_interface (dev_handle. handle, intf)) lib/python2. 7/dist- packages/ usb/backend/ libusb1. py", line 552, in _check _strerror( ret), ret, _libusb_errno[ret]) lib/python2. 7/dist- packages/ usb/backend/ libusb1. py", line 541, in _strerror strerror( errcode) .decode( 'utf8') python2. 7/ctypes/ __init_ _.py", line 378, in __getattr__ getitem_ _(name) python2. 7/ctypes/ __init_ _.py", line 383, in __getitem__ (name_or_ ordinal, self)) linux-gnueabihf /libusb- 1.0.so. 0: undefined symbol: libusb_strerror
[main] enable debug output for module 'nfc'
[nfc.clf] searching for reader with path 'usb'
[nfc.dev.transport] using pyusb version 1.x
[nfc.dev.transport] path matches '^(usb|)$'
[nfc.dev] trying usb:072f:2200
[nfc.dev] import nfc.dev.acr122
Traceback (most recent call last):
File "tagtool.py", line 516, in <module>
TagTool().run()
File "/home/
while self.run_once() and self.options.loop:
File "/home/
try: clf = nfc.Contactless
File "/home/
if path and not self.open(path):
File "/home/
self.dev = nfc.dev.
File "/home/
usb = transport.USB(bus, dev)
File "/home/
self.
File "/home/
self.
File "/usr/local/
return self.device.
File "/usr/local/
intf, ep = self._ctx.
File "/usr/local/
self.
File "/usr/local/
self.
File "/usr/local/
_check(
File "/usr/local/
raise USBError(
File "/usr/local/
return _lib.libusb_
File "/usr/lib/
func = self.__
File "/usr/lib/
func = self._FuncPtr(
AttributeError: /lib/arm-
Is there an issue with the Python version?