[Twisted-Python] Traceback from pb-Server

Jp Calderone exarkun at divmod.com
Thu Jun 23 17:32:21 EDT 2005

On Thu, 23 Jun 2005 10:53:31 +0200, Stephan Popp <stephan.popp at iisb.fraunhofer.de> wrote:
>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' %


    exarkun at boson:~$ python
    Python 2.4.1 (#2, Mar 30 2005, 21:51:10) 
    [GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> def calc(a, b):
    ...     exec 'from %s import %s as func' % (a, b)
    >>> calc("os import system; system('echo Boo'); from foo", "bar")
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
      File "<stdin>", line 2, in calc
      File "<string>", line 1, in ?
    ImportError: No module named foo


More information about the Twisted-Python mailing list