[Twisted-Python] Factory.startFactory being called twice.

andrew-twisted at puzzling.org andrew-twisted at puzzling.org
Tue Jan 29 18:56:40 EST 2002

Hi all,

I recently upgraded to 0.14.0, but I'm still seeing Factory.startFactory()
being called twice when I start my server.

If I start my server with the following code (adapted from simpleserv.py):

    app = Application('spam')
Then by using traceback.format_stack() in MyFactory.startFactory I can see
that it gets called twice, here:

  File "F:\Python22\Lib\site-packages\twisted\internet\app.py", line 350, in run
  File "F:\Python22\Lib\site-packages\twisted\internet\tcp.py", line 395, in startListening

and here:

  File "F:\Python22\Lib\site-packages\twisted\internet\app.py", line 357, in run

I'm currently using 
    if not hasattr(self, 'once'):
        self.once = 1
	# ...

To workaround it, but it'd be nice to not need to do this.

The docs suggest that it will get called twice, "both after an application
has been unserialized and before all the ports begin accepting connections."
Which is fine, except that I'm not unserialising...

It's a minor glitch in an otherwise beautiful system :)


More information about the Twisted-Python mailing list