hmarr/mongoengine — Issue #321: thread identity error in python 2.5
Author: cman122887
Created: 2011-10-17 22:21:19+00:00
State: open

def get_identity():
"""
Creates an identity key based on the current process and thread identity.
"""
identity = multiprocessing.current_process()._identity
identity = 0 if not identity else identity[0]

identity = (identity, threading.current_thread().ident)
return identity

on 2.5 this error pops up

# AttributeError: '_MainThread' object has no attribute 'ident' #

import thread
thread.get_ident()

works though

they deprecated thread for threading but threading did not have a main thread identity till 2.6