[Python-Dev] UUID module
skip at pobox.com
skip at pobox.com
Sat Jun 10 22:02:57 CEST 2006
Thomas> On OS X, this call is not available, but /usr/lib/libc.dylib has
Thomas> a uuid_generate function which is apparently compatible to the
Thomas> linux example I posted above.
Confirmed:
% python
Python 2.5a2 (trunk:46644M, Jun 4 2006, 10:58:16)
[GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes.util import find_library
>>> print find_library("c")
/usr/lib/libc.dylib
>>> from ctypes import *
>>> libc = CDLL("libc.dylib")
>>> uuid = create_string_buffer(16)
>>> libc.uuid_generate(uuid, 1)
-1073747536
>>> print repr(uuid[:])
'\x03K\xab\x0e\x96\xba at 3\xa5\x9f\x04\x1d\x9b\x91\x08\x1b'
Skip
More information about the Python-Dev
mailing list