wraith-wireless / PyRIC

Python wireless library for Linux
http://wraith-wireless.github.io/PyRIC
Other
93 stars 51 forks source link

TypeError: not all arguments converted during string formatting #5

Closed ghost closed 8 years ago

ghost commented 8 years ago

Description: This is an error that I got after to get all modes for an interface.

Script Output:

Traceback (most recent call last):
  File "bin/wifiphisher", line 12, in <module>
    run()
  File "/root/pyric-test/wifiphisher/pywifiphisher.py", line 767, in run
    args.apinterface)
  File "/root/pyric-test/wifiphisher/interfaces.py", line 246, in __init__
    self._check_compatibility(interface_object)
  File "/root/pyric-test/wifiphisher/interfaces.py", line 270, in _check_compatibility
    modes = pyric.devmodes(card)
  File "/root/pyric-test/PyRIC/pyric/pyw.py", line 456, in devmodes
    return _nlstub_(devmodes,card)
  File "/root/pyric-test/PyRIC/pyric/pyw.py", line 957, in _nlstub_
    return fct(*argv)
  File "/root/pyric-test/PyRIC/pyric/pyw.py", line 458, in devmodes
    return phyinfo(card,nlsock)['modes']
  File "/root/pyric-test/PyRIC/pyric/pyw.py", line 572, in phyinfo
    info['modes'] = [_iftypes_(struct.unpack('>H',mode)[0]) for mode in modes]
  File "/root/pyric-test/PyRIC/pyric/pyw.py", line 926, in _iftypes_
    return 'Unknown mode ({0})' % i
TypeError: not all arguments converted during string formatting
ghost commented 8 years ago

The fix is to change

return 'Unknown mode ({0})' % i

to

return 'Unknown mode ({0})'.format(i)
wraith-wireless commented 8 years ago

Crap my bad. Have just recently switched to str.format and still running into some typos. Will fix.

wraith-wireless commented 8 years ago

Done