You are right, I'll try to figure out the mistake in my configuration of 
logging system in my spare time.
Many thanks!

On Monday, September 19, 2016 at 7:24:19 PM UTC+8, Martin Richard wrote:
>
> 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 <a13...@gmail.com <javascript:>>:
>
>> 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