Twisted problem

Elbert Lev elbertlev at hotmail.com
Wed Nov 3 12:03:47 EST 2004


exarkun at divmod.com wrote in message news:<mailman.5821.1099415659.5135.python-list at python.org>...
> (Cross posting to twisted-python at twistedmatrix.com)
> 
> 
>   I can't quite tell what you're doing, or what error you're actually getting.  Can you include the full command line you are running, the full source file you are working with (or, preferably, a shorter one that demonstrates the same problem), and the full text of the error you receive, including the traceback if there is one?
> 
>   Jp

# Here is the script finger.tac (exact copy of tut. step 11)

from twisted.application import internet, service
from twisted.internet import protocol, reactor, defer
from twisted.protocols import basic
class FingerProtocol(basic.LineReceiver):
    def lineReceived(self, user):
        self.factory.getUser(user
        ).addErrback(lambda _: "Internal error in server"
        ).addCallback(lambda m:
                      (self.transport.write(m+"\r\n"),
                       self.transport.loseConnection()))
class FingerFactory(protocol.ServerFactory):
    protocol = FingerProtocol
    def __init__(self, **kwargs): self.users = kwargs
    def getUser(self, user):
        return defer.succeed(self.users.get(user, "No such user"))
application = service.Application('finger', uid=1, gid=1)
factory = FingerFactory(moshez='Happy and well')
r = internet.TCPServer(1079, factory)
r.setServiceParent(service.IServiceCollection(application))

# here is the command line:
#G:\Python23\Lib\site-packages\twisted\scripts\twistw.py  -ny
finger.tac -l c:\finger.log

As I stated no traceback and no output!



More information about the Python-list mailing list