[Python-Dev] UUID module

Ka-Ping Yee python-dev at zesty.ca
Sat Jun 10 17:22:53 CEST 2006

Hi Thomas,

> This does not work, for several reasons.
> 1. (pythoncom|pywintypes).CreateGuid() return a PyIID instance, which you cannot slice:

You're right.  The PEAK code must have been based on an earlier
version of the CreateGuid() routine.

I've fixed this, and added detection of the UUID version so that
the MAC address will only be picked up if the UUID version is 1.

> (BTW: Why does it first try pywintypes, the pythoncom?)

Because PEAK does this, and i see the CreateGuid routine imported
from both modules in Google searches for code, i assumed that it
used to live in one module and moved to the other.

I've also figured out how to get the MAC address using NetBIOS
calls, and added that to the repertoire of methods.  I've tested
this and it works fast.  I think this may be better than
UuidCreateSequential, because it should work on both Win98 and XP.

The updated version is posted at http://zesty.ca/python/uuid.py .

-- ?!ng

More information about the Python-Dev mailing list