You cannot pickle class method, there is an enhancement request about it http://bugs.python.org/issue9276
See there for what objects can be picked and modify your code appropriate.
Question
I am able to send math.sqrt over a Pyro connection however I cannot send a function that I have defined myself over a Pyro connection.
When I do, I get an Pickle Function Error.
Both the receiving module and the sending module have the function defined.
Pyro.core.initClient()
connection = Pyro.core.getProxyForURI("PYRONAME://HelloWOlrd")
print connection.makeRequest(my_function)
And in my receiving side:
def makeRequest(self, function):
return function(9)
Again, if I send a math.sqrt function over the connection, it prints out 3 which is expected, though If I try to send over a function I made, it gives me a pickle error:
cPickle.PicklingError: Can't pickle : attribute lookup builtin.function failed
Again both the receieving module and the sending module have the function defined in their namescapes.
Does anyone know how I can solve this issue?
Solution
You cannot pickle class method, there is an enhancement request about it http://bugs.python.org/issue9276
See there for what objects can be picked and modify your code appropriate.