Python Forum
Encoding and mac-vendor-lookup library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Encoding and mac-vendor-lookup library
#1
Hi everyone!
I'm pretty new to python, so i want to look-up a mac address using mac-vendor-lookup library.
When i run the script on my laptop (Intel-P 3.7.4) everything works fine, but when i run it with my PC (AMD-P 3.8.1)
It's got error:
Here's the error.

Output:
C:\Users\ADMIN>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from mac_vendor_lookup import *
>>> a = '18:60:24:aa:dd:bd'
>>> print(MacLookup().lookup(a))
Error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mac_vendor_lookup.py", line 84, in lookup return self.loop.run_until_complete(self.async_lookup.lookup(mac)) File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 612, in run_until_complete return future.result() File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mac_vendor_lookup.py", line 72, in lookup return self.prefixes[mac[:6]].decode("utf8") KeyError: b'186024' >>>
I Hope you guys can help me out.
Many thanks!
Reply
#2
You are getting a key error saying the key "186024" was not found. MacLookup() must create a dictionary and MacLookup().lookup() was unable to find the provided mac address. I peeked at the project description and it doesn't say how it handles not finding the provided mac address. Maybe it throws an exception.

In an interactive python console what do you get when you type:
import 'mac_vendor_lookup'
help('mac_vendor_lookup')

Anther user reported the same error as you when running on windows:

https://github.com/bauerj/mac_vendor_lookup/issues/3

Sounds like MacLookup() creates some kind of database (in an 806KB file) and building the database can be interrupted by doing the lookup(). What happens if you do this:

db = MacLookup()
time.sleep(1)
print(db.lookup(a))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  2-dataframe, datetime lookup problem Mark17 0 1,243 Jan-27-2022, 01:02 AM
Last Post: Mark17
  Python VLookup? Lookup Table? Nu2Python 3 2,439 Oct-25-2021, 08:47 PM
Last Post: Nu2Python
  Can I replace IF statements with a key lookup ? jehoshua 3 2,534 Mar-05-2021, 10:24 PM
Last Post: jehoshua
  python 3 dns lookup private domain didact 1 2,579 Sep-19-2020, 06:01 PM
Last Post: bowlofred
  Partial key lookup in dictionary GaryNR 1 3,468 Jul-16-2020, 06:55 PM
Last Post: Gribouillis
  Excel Lookup riteshprakash 0 1,779 Sep-11-2019, 12:43 PM
Last Post: riteshprakash
  fast lookup for array markB 3 4,070 May-13-2019, 12:11 AM
Last Post: scidam
  lookup tables Skaperen 4 3,249 Aug-13-2018, 06:43 AM
Last Post: Gribouillis
  Lookup tables parrytoss 0 2,505 Feb-07-2018, 08:45 AM
Last Post: parrytoss
  Reading specific rows (lookup) rumbles 3 3,379 Jan-03-2018, 04:07 PM
Last Post: hshivaraj

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020