done.result() should raise an AttributeError (as you should have wrote
task.result()).
When the logger is disabled, task.result() raise the exception.

The mistake is somewhere in your configuration of the logging system: it
suppresses the output of the exception.
For instance, when I call logging.error("test log") instead of
fileConfig(), the output is:

    ERROR:root:test
    No exception raise
    ERROR:asyncio:Task exception was never retrieved
    future: <Task finished coro=<sync() done, defined at test.py:48>
exception=NameError("name 'undefined' is not defined",) created at
/usr/lib/python3.5/asyncio/tasks.py:345>
    source_traceback: Object created at (most recent call last):
    ...

Which shows that the exception is indeed logged.

2016-09-19 13:16 GMT+02:00 hilo jack <a132...@gmail.com>:

> done, pending = asyncio.get_event_loop().run_until_complete(asyncio.wait([
> sync(), sync()])) # terminated here
> print(pending)
> for task in done:
>      done.result()  # it will not raise the exception
>
>
> To get exceptions, I use asyncio.gather(*tasks) instead.
>
> asyncio.get_event_loop().run_until_complete(asyncio.gather(*[sync(), sync
> ()])) #  it will  raise  exception
>
>
>


-- 
Martin <http://www.martiusweb.net> Richard
www.martiusweb.net

Reply via email to