[Twisted-Python] Amazing exception "GeneratorExit"
Аркадий Левин
poisonoff at gmail.com
Fri Jan 25 09:50:58 MST 2013
I try answer myself, reason for this error broken reference?
On Fri, Jan 25, 2013 at 10:35 PM, Аркадий Левин <poisonoff at gmail.com> wrote:
> 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