[Twisted-Python] Traceback from pb-Server
Stephan Popp
Stephan.Popp at iisb.fraunhofer.de
Thu Jun 23 04:53:31 EDT 2005
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
class ServerObject(pb.Root):
#...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).
More information about the Twisted-Python
mailing list