vegetax wrote:
> Jeff Epler wrote:
>
>> You could write something like
>> class ThreadSpecificFile:
>> def set_stdout(f):
>> self.files[thread_id] = f
>> def write(data):
>> self.files[thread_id].write(data)
>> sys.stdout = ThreadSpecificFile()
>> where you'll have to fill out a few more things like thread_id,
>> __init__, and a way to clean up items from self.files when a thread
>> passes away.
>>
>> Jeff
>
> Thats what i was looking for,Thanks =)
>
So it would be something like this, right??
class ThreadSpecificFile:
def __init__(s):
self.files = []
def set_stdout(f,thread_id):
self.files[thread_id] = f
def clean_up(thread_id):
del self.files[thread_id]
def write(data):
self.files[thread.get_ident()].write(data)
sys.stdout = ThreadSpecificFile()
--
http://mail.python.org/mailman/listinfo/python-list