[Twisted-Python] What is wrong with this instance?

Andrew Bennetts andrew-twisted at puzzling.org
Thu Aug 11 05:33:01 EDT 2005

On Thu, Aug 11, 2005 at 11:01:13AM +0200, Michał Tyde wrote:
> As a topic. I got the code:
> ^^^
> form twisted.protocols.telnet import Telnet
> def keep():
> 	telnet=Telnet()
> 	print type(telnet)
> 	print getattr(telnet,'write')#all OK until here
> 	telnet.write("msg")
> 	print "msg"
> keep()
> ^^^

No, you don't have that code.  Your code has a syntax error in the first
line.  Also:

> and I got
> TypeError: unbound method write() must be called with Telnet instance as
> first argument (got str instance instead)

That's not the error I get with your code, and that's not the error I get
with your code after correcting the obvious typo in the first line.

> I really don't understand where is the mistake.

Neither do I.  I could guess, but I'd have no idea if I was right or not,
because I've no idea what your problem actually is.

Give us the exact code that reproduces your problem, so that we know what's
going on, and then we'll be able to help you.


More information about the Twisted-Python mailing list