Thanks for the code!
Could you nor rerun this code from a terminal via
python scripy.py

and check, if you get a valid stack stace? Jupyter kernels sometimes just get restarted without a proper error message (at least that’s my experience).