Timeout with error "Comms Exception timeout waiting for first EOF reception"

Seemingly, if some code runs in an infinite loop without updating serial often enough it will result in a timeout.

For example,

import time
from pyb import LED

led1 = LED(1)

while True:
    time.sleep_ms(500)
    led1.toggle()

results in a timeout (that requires a reset and reconnect) after a few minutes but

import time
from pyb import LED

led1 = LED(1)

i = 0
while True:
    print(i)
    i+=1
    time.sleep_ms(500)
    led1.toggle()

does not.

Is there a way to turn off the timeout or reset the timeout without spamming the output box too much? (within the context of running a while loop).

It's not a big issue but sometimes I have a while(true) loop I like to leave running for a bit that doesn't print anything for long periods of time, and it's cumbersome to keep resetting the board.

By the way, running Python on a microcontroller from the comfort of Jupyter is absolute magic to me and I love it.