Phillip J. Eby wrote: > At 06:39 PM 6/10/2006 +0200, Thomas Heller wrote: >>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' >> >>> > > Nice. :) But no, this one's a uuidgen() system call on FreeBSD>=5.0 and > NetBSD>=2.0; it may be in other BSD variants as well... perhaps OS X?
For completeness :-), although its probably getting off-topic: $ uname -a FreeBSD freebsd 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov 3 09:36:13 UTC 2005 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC i386 $ python Python 2.4.1 (#2, Oct 12 2005, 01:36:32) [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6 Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes.util import find_library >>> find_library("c") 'libc.so.6' >>> from ctypes import * >>> libc = CDLL("libc.so.6") >>> uuid = create_string_buffer(16) >>> libc.uuidgen(uuid, 1) 0 >>> uuid[:] '\xd2\xff\x8e\xe3\xa3\xf8\xda\x11\xb0\x04\x00\x0c)\xd1\x18\x06' >>> $ On OS X, this call is not available, but /usr/lib/libc.dylib has a uuid_generate function which is apparently compatible to the linux example I posted above. Thomas _______________________________________________ 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