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()"

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to