Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
melyux opened this issue Feb 12, 2017 · 1 comment

Comments

@melyux
Copy link

melyux commented Feb 12, 2017

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!

@melyux melyux changed the title "TypeError: %x format: a number is required, not str" on pcappy.findalldevs() "TypeError: %x format: a number is required, not str" at _parsemac, when using findalldevs() Feb 12, 2017
@melyux melyux changed the title "TypeError: %x format: a number is required, not str" at _parsemac, when using findalldevs() "TypeError: %x format: a number is required, not str" at _parsemac(), when using findalldevs() Feb 12, 2017
@wmnsk
Copy link

wmnsk commented Feb 12, 2017

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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants