From: Ralf S. <rs...@ru...> - 2016-03-31 12:07:39
|
On Thu, Mar 24, 2016 at 12:44:33PM -0500, Jeff LaCoursiere wrote: > if event.name == 'PeerlistComplete': > printResults() > ami.close() > sys.exit(0) This will exit the thread created by manager, not your main thread. You generally shouldn't call exit in the callback functions, these are called by the manager thread. I'd set up a Queue between your callbacks and the main loop and wait for an event on the queue in the main loop (where you're currently only sleeping). Then when receiving that event you can safely exit the main loop. I'm not sure calling ami.close in the callback is a good idea either, you'd probably do that in the main loop, too, e.g. (code completely untested) from Queue import Queue queue = Queue () ... ami = manager.Manager() ... def handleEvent(event, ami): print ("Received event: %s" % event.name) if event.name == 'PeerlistComplete': ... queue.put("End") ... item = queue.get () ami.close () sys.exit (0) Ralf -- Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 Open Source Consulting www: http://www.runtux.com Reichergasse 131, A-3411 Weidling email: of...@ru... |