<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>Dear 
All</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=732223612-12102009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>I am running this 
piece of code:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=732223612-12102009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>from threading 
import Thread<BR>import copy</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>class 
Ashish(Thread):<BR>    def __init__(self, 
i):<BR>        
Thread.__init__(self)<BR>        self.foo = 
i<BR>    def 
run(self):<BR>        print (self, 
self.foo)</SPAN></FONT></DIV>
<DIV> </DIV><FONT><SPAN class=732223612-12102009>
<DIV><BR><FONT face=Arial><FONT size=2>d= Ashish(4)<BR>e = copy.deepcopy(d)<SPAN 
class=732223612-12102009>  <--- Exception 
here....</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>d.start()<BR>e.start()</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>d.join()<BR>e.join()</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>But I am getting 
this error:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=732223612-12102009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>>>> 
<BR>Traceback (most recent call last):<BR>  File 
"D:\Profiles\ntb837\Desktop\threadprob.py", line 13, in 
<module><BR>    e = copy.deepcopy(d)<BR>  File 
"C:\Python31\lib\copy.py", line 173, in deepcopy<BR>    y = 
_reconstruct(x, rv, 1, memo)<BR>  File "C:\Python31\lib\copy.py", line 295, 
in _reconstruct<BR>    state = deepcopy(state, memo)<BR>  
File "C:\Python31\lib\copy.py", line 146, in deepcopy<BR>    y = 
copier(x, memo)<BR>  File "C:\Python31\lib\copy.py", line 235, in 
_deepcopy_dict<BR>    y[deepcopy(key, memo)] = deepcopy(value, 
memo)<BR>  File "C:\Python31\lib\copy.py", line 173, in 
deepcopy<BR>    y = _reconstruct(x, rv, 1, memo)<BR>  File 
"C:\Python31\lib\copy.py", line 295, in _reconstruct<BR>    state 
= deepcopy(state, memo)<BR>  File "C:\Python31\lib\copy.py", line 146, in 
deepcopy<BR>    y = copier(x, memo)<BR>  File 
"C:\Python31\lib\copy.py", line 235, in _deepcopy_dict<BR>    
y[deepcopy(key, memo)] = deepcopy(value, memo)<BR>  File 
"C:\Python31\lib\copy.py", line 173, in deepcopy<BR>    y = 
_reconstruct(x, rv, 1, memo)<BR>  File "C:\Python31\lib\copy.py", line 280, 
in _reconstruct<BR>    y = callable(*args)<BR>  File 
"C:\Python31\lib\copyreg.py", line 88, in __newobj__<BR>    
return cls.__new__(cls, *args)<BR>TypeError: object.__new__(_thread.lock) is not 
safe, use _thread.lock.__new__()</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=732223612-12102009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=732223612-12102009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=732223612-12102009>Could someone please 
help me find a solution?</SPAN></FONT></SPAN></FONT></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2>Regards,<BR>Ashish Vyas</FONT></DIV>
<DIV><EM><FONT face=Arial color=#808080 
size=2></FONT></EM> </DIV></BODY></HTML>