Hi, Please excuse my bad english, I hope you will understand what I mean, otherwise feel free to ask. I'm trying to get error messages from my server. I'm using twisted 2.0.0 with python 2.4. The server looks like this:
from twisted.spread import pb from twisted.internet import reactor, threads
#...some other methods, which aren't involved...
def remote_fitness(self, task, taskDescription, serverID): return threads.deferToThread(self.calc, task, serverID, taskDescription)
def calc(self, task, serverID, taskDescription): exec('from %s import %s as func' % (taskDescription.fileName,taskDescription.functionName)) #problem: file specified in fileName needn't to be in working directory of server func(task) #calulates something return task
if __name__ == '__main__': factory = pb.PBServerFactory(ServerObject()) reactor.listenTCP(8800, factory) reactor.run()
The client calls, after connection is made. def1 = root.call_remote("fitness", task, taskDescription, serverID) def1.addCallback(self.serverCB) def1.addErrback(self.serverErrorCB)
def serverErrorCB(self, reason): print reason
If the pythonscript named taskDescription.fileName isn't there self.serverErrorCB is called - thats ok. But it prints: reason [Failure instance: Traceback from remote host -- Traceback unavailable]
But I need to know why the call failed. Can anyone please help me to get the traceback or the exception message that the server prints (exceptions.ImportError: No module named fitfunc2).