Phillip J. Eby wrote: > At 08:22 AM 6/10/2006 -0500, Ka-Ping Yee wrote: >>Finally, Phillip brought up PEAK: >> > PEAK's uuid module does this such that if win32all is present, >> > you get a Windows GUID, or if you have a FreeBSD 5+ or >> > NetBSD 2+ kernel you use the local platform uuidgen API. See e.g.: >> >>...so i looked at PEAK's getnodeid48() routine and borrowed the >>Win32 calls from there, with a comment giving attribution to PEAK. > > There appears to be a transcription error, there; the second win32 import > isn't covered by a try/except and the ImportError seems to have disappeared > as well. > > Also, for Python 2.5, these imports could probably be replaced with a > ctypes call, though I'm not experienced enough w/ctypes to figure out what > the call should be. > > Similarly, for the _uuidgen module, you've not included the C source for > that module or the setup.py incantations to build it. But again, it could > probably be replaced by ctypes calls to uuidgen(2) on BSD-ish platforms. > > I'll take a whack at addressing these once the code is in, though, unless > there's a ctypes guru or two available...?
I don't know if this is the uuidgen you're talking about, but on linux there is libuuid: >>> from ctypes import * >>> lib = CDLL("libuuid.so.1") >>> uuid = create_string_buffer(16) >>> lib.uuid_generate(byref(uuid)) 2131088494 >>> from binascii import hexlify >>> hexlify(buffer(uuid)) '0c77b6d7e5f940b18e29a749057f6ed4' >>> _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com