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

Andrew Bennetts andrew-twisted at puzzling.org
Thu Aug 11 06:44:43 EDT 2005


On Thu, Aug 11, 2005 at 12:26:30PM +0200, Michał Tyde wrote:
> Sorry I dont want to send too large posts, so I shorten the problem. I
> am writing a telnet client, and I got a little problem with keeping
> connection alive (thread: [Twisted - Python] Telnet client & keeping
> connection alive). I use a reactor.callLater() loop, and i can't exectue
> a method i have written in Protocol class. I try to execute this method
> in the end of code before reactor.run(). 

Sorry, I'm not sure exactly what the problem you're having is.

Shortening the problem is great, but it needs to be something that I can run
and see the exact same error you are seeing, rather than SyntaxErrors or
completely different errors.

With this longer example I'm not sure what part of it is not behaving as you
expect.  Taking a guess and uncommenting this line:

> 		#c()#doesn't execute

Gives me this error when I run your code:

Traceback (most recent call last):
  File "/tmp/blah.py", line 201, in ?
    telnet_KeepAlive()
  File "/tmp/blah.py", line 198, in telnet_KeepAlive
    c()#doesn't execute
  File "/tmp/blah.py", line 151, in telnet_KeepAlive
    self.write("pwd\n\r")
  File "/usr/lib/python2.4/site-packages/twisted/protocols/telnet.py", line 181, in write
    self.transport.write(data)
AttributeError: 'NoneType' object has no attribute 'write'

Is this what you're referring to?

I feel like I'm trying to read minds here, and I'm not very good at that :)

-Andrew.





More information about the Twisted-Python mailing list