tags:

views:

196

answers:

2

I am trying to run a simple twisted application echo bot that metajack blogged about, everything looks like it is going to load fine, but at the very end I get an error:

2009/07/12 15:46 -0600 [-] ImportError: cannot import name toResponse
2009/07/12 15:46 -0600 [-] Failed to load application: cannot import name toResponse

Any ideas on what might be causing this?

I've not played with wokkel/twisted/python at all and dont know where to start to look.

It is worth nothing that I've tried another wokkel/twisted app and got this very same error.

A: 

There's not really enough information to go on, but if I had to guess, I'd say that you've given your program the same name as one of the modules that it relies on. Try renaming it to anthonys_echo_bot.py and re-running it. Do this:

rm *.pyc

in the directory in which you're running it first.

If that doesn't help, you'll need to track down the piece of code that's trying import toResponse - is that all the error you get? No traceback, pointing to lines of code?

RichieHindle
Orig Code:http://metajack.im/2008/09/25/an-xmpp-echo-bot-with-twisted-and-wokkel/?dsq=12557043#comment-125570432009/07/12 15:51 -0600 [-] File "build/bdist.macosx-10.5-i386/egg/wokkel/client.py", line 18, in <module>2009/07/12 15:51 -0600 [-] File "build/bdist.macosx-10.5-i386/egg/wokkel/generic.py", line 14, in <module>2009/07/12 15:51 -0600 [-] ImportError: cannot import name toResponse2009/07/12 15:51 -0600 [-] Failed to load application: cannot import name toResponseRunning this code gives the same error as above:http://wokkel.ik.nu/browser/trunk/doc/examples/pinger_client.tac
Anthony Webb
in wokkel (generic.py) it imports toResponse with:from twisted.words.protocols.jabber.xmlstream import toResponseIs there any reason why it would not be able to import that?
Anthony Webb
toResponse is def'd here, line 822: http://twistedmatrix.com/trac/browser/trunk/twisted/words/protocols/jabber/xmlstream.py
Anthony Webb
funny enough my version of xmlstream.py is only like 697 lines and the one in the link above is like double that. Odd since I just installed twisted fresh today using the binary on the site.
Anthony Webb
+1  A: 

This error is caused because I have an outdated version of Twisted. Off to find a way to update twisted itself as the installer doesnt seem to be doing the trick.

Anthony Webb