February 28th, 2004, 06:43 PM
Join Date: Feb 2004
Time spent in forums: < 1 sec
Reputation Power: 0
How do I sendLine externally with a twisted.basic.LineReceiver?
Hello. I'm trying to get a better grasp of Twisted and Tkinter programming by writing a simple chat program. My server is simple enough and works well, and the client mostly works except for 1 problem:
The client cannot call the basic.LineReceiver class from any other class to sendLine. It can can call any function from the basic.LineReceiever so long as the function does not sendLine.
The error I receive when trying to call sendLine from chatFacory.sendMessage() is this:
return self.transport.write(line + self.delimiter)
AttributeError: 'NoneType' object has no attribute 'write'
The classes I am working with are as follows:
self.sendLine("A new person has entered the room!")
def lineReceived(self, line):
app.text_output.config(state=NORMAL) #enable text_output for insert
app.text_output.insert(END, line +"\n")
app.text_input.delete(0, END) #clear text_input
app.text_output.see(END) #move scrollbar to the bottom
def connectionLost(self, reason):
from twisted.internet import reactor
protocol = chatClient
def clientConnectionFailed(self, connector, reason):
print "Connection failed - goodbye!"
def clientConnectionLost(self, connector, reason):
print "Connection lost - goodbye!"
c = chatClient()
If anyone has run across a similar problem and can offer any advice, I would greatly appreciate it!