[Twisted-Python] factory class has no __class__ attribute!

Jean-Paul Calderone exarkun at divmod.com
Thu Mar 1 10:47:23 EST 2007

On Thu, 01 Mar 2007 15:37:41 +0000, John Pote <johnpote at jptechnical.co.uk> wrote:
>Hi everyone,
>Justed started out to get a twisted http server going. typed in example 4.2 
>from Fettig's book but when I run it this strange error is reported:
> [snip]
>AttributeError: class myhttpFactory has no attribute '__class__'
>anyone shed any light on this?
> [snip]
>class myhttpFactory(http.HTTPFactory):
>    protocol = httpProtocol

Here you defined a protocol factory class.

>if __name__ == "__main__":
>    from twisted.internet import reactor
>    from twisted._version import version
>    print "twisted ver:"+version.short()
>    print "python ver:"+sys.version
>    reactor.listenTCP(8000, myhttpFactory)

Here you passed it to listenTCP, when you should have pass an instance of
it to listenTCP:

    reactor.listenTCP(8000, myhttpFactory())

>    reactor.run()


More information about the Twisted-Python mailing list