I am using websockets and asyncio in Python 3.6.3 on windows cygwin.
It was slightly simplified for reading.
It run and outputed correctly for a while, but later nothing was printed. I pressed ctrl+C, and got this on exiting:
Exception ignored in: <generator object WebSocketCommonProtocol.close_connection at 0x6fffe9349e8>
RuntimeError: generator ignored GeneratorExit
Did it means the try catch not working? or Did I do it the wrong way?
except:
You should never do such thing since it catches also service (non-error) exceptions such as GeneratorExit
.
Change it with:
except Exception:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.