[Twisted-Python] Amazing exception "GeneratorExit"

Аркадий Левин poisonoff at gmail.com
Fri Jan 25 11:35:17 EST 2013


Hi all, i got strange error

If run this:

# -*- coding: UTF-8 -*-

import os
import sys

from twisted.python import log
from twisted.internet import reactor
from twisted.internet.defer import Deferred, inlineCallbacks

@inlineCallbacks
def _():

	try:
		(yield Deferred())
	except:
		log.err()

reactor.callLater(0, _)
reactor.run()

i got exception  "GeneratorExit" Why?!

... this code work:

# -*- coding: UTF-8 -*-

import os
import sys

from twisted.python import log
from twisted.internet import reactor
from twisted.internet.defer import Deferred, inlineCallbacks

@inlineCallbacks
def _():

	deferred = Deferred()

	try:
		(yield deferred)
	except:
		log.err()

reactor.callLater(0, _)
reactor.run()

Change "Deferred()" to "deferred = Deferred()"



More information about the Twisted-Python mailing list