[Twisted-Python] run python application with twistd -y ifinger.tac, error occurs. please help to check

吴志高 wuzhigaoem at 163.com
Tue Sep 17 01:53:40 MDT 2013







Experts:
您好!

my ifinger.tac file content like following:
fromtwisted.applicationimportinternet, servicefromtwisted.internetimportprotocol, reactor, deferfromtwisted.protocolsimportbasicclassFingerProtocol(basic.LineReceiver):
    deflineReceived(self, user):
        d = self.factory.getUser(user)

        defonError(err):
            return'Internal error in server'd.addErrback(onError)

        defwriteResponse(message):
            self.transport.write(message + '\r\n')
            self.transport.loseConnection()
        d.addCallback(writeResponse)

classFingerFactory(protocol.ServerFactory):
    protocol = FingerProtocoldef__init__(self, **kwargs):
        self.users = kwargsdefgetUser(self, user):
        returndefer.succeed(self.users.get(user, "No such user"))

application = service.Application('finger', uid=1, gid=1)
factory = FingerFactory(moshez='Happy and well')
internet.TCPServer(79, factory).setServiceParent(service.IServiceCollection(application))                   


when running this script with command-line : twistd -y ifinger.tac, error occurs like :


Traceback (most recent call last):
    File "/usr/local/bin/twistd", line 7, in <module>
        import _preamble
ImportError: No module named '_preamble'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):
    File "/usr/local/bin/twistd", line 9, in <module>
        sys.exc_clear()
AttributeError: 'module' object has no attribute 'exc_clear'


And i run python3 in interactive mode to check if exc_clear method is defined in sys,  command line like :
>>>import sys
>>>sys.__dict__["exc_clear"]
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
        sys.exc_clear()
KeyError: 'exc_clear'
>>>


Is there any configuration i should do ? please help to give me an answer.


 谢谢!!
----------------------------
姓名 : 吴志高/Charles
电话 : (+086)13410859946

邮箱 : wuzhigaoem at 163.com
================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130917/0596cad1/attachment.html>


More information about the Twisted-Python mailing list