<!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.5764" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff>I have a
wxPython application that is creating a subprocess that performs a lengthy
log analysis.</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff>Currently,
the subprocess is displaying its results using its own
MainLoop().</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff>I want to
display the subprocess' results using the parent process'
MainLoop().</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff>I tried to
pickle the class instance that is displaying the subprocess results (so the
subclass could be sent to the parent process for display), but I get the
following error:</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier>cPickle.PicklingError:
Can't pickle <type 'PySwigObject'>: attribute lookup
__builtin__.PySwigObject failed<BR></FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff>A code that
demonstrate the problem is:</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier>$ cat
pickle_test.py<BR>#!/usr/bin/env python</FONT></SPAN></DIV>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier>#import pickle<BR>import
cPickle as pickle<BR>import wx</FONT></SPAN></DIV>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier>class
ListControl(wx.Frame):</FONT></SPAN></DIV>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier> def
__init__(self, parent, id):<BR>
wx.Frame.__init__(self,parent,id)</FONT></SPAN></DIV>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier>if __name__ ==
"__main__":</FONT></SPAN></DIV>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff><FONT
face=Courier color=#000000> app =
wx.App(redirect=False)<BR> output =
pickle.dumps(ListControl(None, -1),2)</FONT><BR></FONT></SPAN></DIV><SPAN
class=309525213-25052009><FONT face=Arial color=#0000ff>
<DIV></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial color=#0000ff>Any ideas
what could be changed to let me pickle the class ?</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff>Ron.</FONT></SPAN></DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Arial
color=#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=309525213-25052009><FONT face=Courier>$ cat -n
pickle_test.py<BR> 1 #!/usr/bin/env
python<BR> 2<BR> 3 #import
pickle<BR> 4 import cPickle as
pickle<BR> 5 import wx<BR>
6<BR> 7 class
ListControl(wx.Frame):<BR> 8<BR>
9 def __init__(self, parent,
id):<BR>
10
wx.Frame.__init__(self,parent,id)<BR> 11<BR>
12 if __name__ == "__main__":<BR>
13<BR> 14 app =
wx.App(redirect=False)<BR> 15
output = pickle.dumps(ListControl(None, -1),2)</FONT></SPAN></DIV><SPAN
class=309525213-25052009>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><FONT face=Courier>$ python -u pickle_test.py<BR>Traceback (most recent
call last):<BR> File "pickle_test.py", line 15, in
<module><BR> output = pickle.dumps(ListControl(None,
-1),2)<BR>cPickle.PicklingError: Can't pickle <type 'PySwigObject'>:
attribute lookup __builtin__.PySwigObject failed</FONT></DIV>
<DIV><FONT face=Courier></FONT> </DIV>
<DIV><FONT face=Courier>$ </FONT></SPAN></DIV></BODY></HTML>