Hi,
I have a wxPython application that is creating a subprocess that performs a lengthy log analysis.
Currently, the subprocess is displaying its results using its own MainLoop().
I want to display the subprocess’ results using the parent process’ MainLoop().
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:
cPickle.PicklingError: Can’t pickle <type ‘PySwigObject’>: attribute lookup builtin.PySwigObject failed
A code that demonstrate the problem is:
$ cat pickle_test.py
#!/usr/bin/env python
#import pickle
import cPickle as pickle
import wx
class ListControl(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self,parent,id)
if name == “main”:
app = wx.App(redirect=False)
output = pickle.dumps(ListControl(None, -1),2)
Any ideas what could be changed to let me pickle the class ?
Thanks,
Ron.
$ cat -n pickle_test.py
1 #!/usr/bin/env python
2
3 #import pickle
4 import cPickle as pickle
5 import wx
6
7 class ListControl(wx.Frame):
8
9 def init(self, parent, id):
10 wx.Frame.init(self,parent,id)
11
12 if name == “main”:
13
14 app = wx.App(redirect=False)
15 output = pickle.dumps(ListControl(None, -1),2)
$ python -u pickle_test.py
Traceback (most recent call last):
File “pickle_test.py”, line 15, in
output = pickle.dumps(ListControl(None, -1),2)
cPickle.PicklingError: Can’t pickle <type ‘PySwigObject’>: attribute lookup builtin.PySwigObject failed
$