Comment 16 for bug 1257591

Revision history for this message
casall (thorirtr) wrote :

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

Is there an issue with the Python version?