How to avoid this ssl.SSLError, or simply ignore?

Viewed 2572

The program should allow to run several https get requests with one aiohttp.ClientSession as the documentation suggests. It is intended to run a telegram bot.

I was not able to catch the exception with try ... except. Therefore the program hangs when exiting. During extended sessions the error is printed in the command windows (but not in the error log).

SSL error in data received
protocol: <asyncio.sslproto.SSLProtocol object at 0x0000016A581E4400>
transport: <_SelectorSocketTransport fd=644 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "C:\Users\annet\Anaconda3\lib\asyncio\sslproto.py", line 526, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "C:\Users\annet\Anaconda3\lib\asyncio\sslproto.py", line 207, in feed_ssldata
    self._sslobj.unwrap()
  File "C:\Users\annet\Anaconda3\lib\ssl.py", line 767, in unwrap
    return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2592)
^C

As the error information is very unspecific I could not really isolate the source and have a short code to reproduce the error. A sample code is on github under https://github.com/fhag/telegram2.git In order to run the code you will need an API token from telegram of your own bot. This error showed up the first time when I upgraded to python 3.7.1. Python is running on Windows 10.

0 Answers
Related