[Twisted-Python] Non-list expression received, 'Server' object has no attribute 'socket'

Alex Couper amcouper at gmail.com
Fri Dec 2 09:28:32 EST 2005


I have an application that requires each node using it to update each other,
and to fetch updates automatically. Each node, therefore, has a server and a
client on it.
I am receiving different errors each time I run the program, and they are
coming from within the twisted packages, (shown below)

Error 1:
  File "C:\Python24\lib\site-packages\twisted\internet\tcp.py", line 89, in
_closeSocket
    skt = self.socket
exceptions.AttributeError: 'Server' object has no attribute 'socket'

Error 2:
  File "C:\Python24\lib\site-packages\twisted\spread\pb.py", line 572, in
expressionReceived
    raise ProtocolError("Non-list expression received.")
twisted.spread.pb.ProtocolError: Non-list expression received.


I suspect that they are caused by the way that I am running my server. On
occasion, reactor.run() finishes, and thus there is no longer a server
running in effect. I therefore use a while loop to always be running the
server. The server is launched as a thread.

def run(self):
        while 1:
            application = service.Application("copy_receiver")
            internet.TCPServer(8800, pb.PBServerFactory
(self)).setServiceParent(
                service.IServiceCollection(application))
            self.listener = reactor.listenTCP(8800, pb.PBServerFactory
(self))

            #installSignalHandlers=0 allows the reactor to run in a non-main
thread
            reactor.run(installSignalHandlers=0)

Is this known to cause problems? If not, any ideas of why i might be getting
the error messages? or any ideas how I can keep the server running so that
it doesn't exit?


Alex Couper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20051202/0c98c4c7/attachment.htm 


More information about the Twisted-Python mailing list