[Python-Dev] beta1 coming real soon (original) (raw)

Paul Moore p.f.moore at gmail.com
Sat Jun 10 17:36:16 CEST 2006


On 6/10/06, Johan Dahlin <jdahlin at async.com.br> wrote:

Ka-Ping Yee wrote: > On Thu, 8 Jun 2006, Neal Norwitz wrote: >> If you plan to make a checkin adding a feature (even a simple one), >> you oughta let people know by responding to this message. Please get >> the bug fixes in ASAP. Remember to add tests! > > Just to make this appear on this thread: i'm planning to check in > the uuid.py module at http://zesty.ca/python/uuid.py (with tests).

Just a quick comment, ipconfig is localized on my system so it'll output something like this: endereço inet6: fe80::20e:a6ff:feac:c3bd/64 Escopo:Link So it needs to be run with LANG set to C to avoid this.

Actually, the code uses "ifconfig", which doesn't exist on Windows. You want the command "ipconfig /all". And it assumes Windows is installed on the C: drive (normal, but not guaranteed).

Perhaps it would be better to use the same API ipconfig uses, but it's highly platform specific of course.

Here's a VB script that gets all the MAC addresses on the system using WMI:

Dim objNetworkAdapters, objAdapter, objWMI

Set objWMI = Nothing Set objWMI = GetObject("winmgmts:")

' Get a list of IP-enabled adapters. Set objNetworkAdapters = objWMI.ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled = 1")

For Each objAdapter In objNetworkAdapters wscript.echo "Network adapter: " & objAdapter.Caption & " has MAC address " & objAdapter.MacAddress Next

It might be worth noting that on my PC, this gets one "real" network adapter, and two VMWare virtual adapter. Whether this affects things, I don't know. This script and ipconfig /all give the adapters in different orders.

Paul.



More information about the Python-Dev mailing list