Getting Local MAC Address

Michael Torrie torriem at
Fri Apr 2 23:51:26 CEST 2010

On 04/02/2010 02:14 PM, Booter wrote:
> I am new to python ans was wondering if there was a way to get the mac
> address from the local NIC?

As Dan has indicated, you have to Popen an external command to get this
information.  Every OS has different commands and syntaxes for this.
You'll have to have a different Popen for each operating system.  Also
you must take into account that most computers have more than one
ethernet interface these days (real and virtual).  So you'll likely end
up with between 2 and 5 different MAC addresses.  And some of those are
fake as well, like the MAC addresses used by VMware's virtual networking

What operating system are you targeting?  Windows?  Linux?  Mac?  To
really answer your question you must supply more information.

More information about the Python-list mailing list