allfro/pcappy

"TypeError: %x format: a number is required, not str" at _parsemac(), when using findalldevs()

melyux opened this issue · 1 comments

Traceback (most recent call last):
  File "go.py", line 167, in <module>
    quit(str(pcap.findalldevs()))
  File "/pcappy/__init__.py", line 112, in findalldevs
    return _findalldevs(devs)
  File "/pcappy/__init__.py", line 97, in _findalldevs
    devices.append(PcapPyInterface(top))
  File "/pcappy/__init__.py", line 201, in __init__
    addr=self._parseaddrs(topaddr.addr),
  File "/pcappy/__init__.py", line 315, in _parseaddrs
    sdl_data=self._parsemac(string_at(byref(sa.sdl.sdl_data, sa.sdl.sdl_nlen), sa.sdl.sdl_alen))
  File "/pcappy/__init__.py", line 227, in _parsemac
    return ':'.join(['%02x' % i for i in mac])
TypeError: %x format: a number is required, not str

This is on macOS. I tried to see if I could fix it, but had no luck!

wmnsk commented

Did you try:

    return ':'.join(['%02x' % ord(i) for i in mac])

instead of:

    return ':'.join(['%02x' % i for i in mac])

at 'File "/pcappy/init.py", line 227, in _parsemac' ?

If this doesn't work, it's better to tell the maintainers(I'm NOT the one) how we can reproduce it and ask them for the advice.

Hope this helps :-)