import multiprocessing import uuid def get_uuid( a ): ## Doesn't help to cycle through a bunch. #for i in xrange(10): uuid.uuid4() ## Doesn't help to reload the module. #reload( uuid ) ## Doesn't help to load it at the last minute. ## (I simultaneously comment out the module-level import). #import uuid ## uuid1() does work, but it differs only in the first 8 characters and includes identifying information about the computer. #return uuid.uuid1() ## This works; it is exactly what the uuid module does in the absence of a platform uuid_generate_random(). #import os #return uuid.UUID( bytes = os.urandom(16), version = 4 ) ## This also works; it causes the uuid module not to use the platform's uuid_generate_random(). #uuid._uuid_generate_random = None return uuid.uuid4() def main(): pool = multiprocessing.Pool( 20 ) uuids = pool.map( get_uuid, range( 20 ) ) for id in uuids: print id if __name__ == '__main__': main()