Minimal working example:
import i3ipc
def on_window(self, e):
raise Exception
conn = i3ipc.Connection()
conn.on('window', on_window)
conn.main()
This will just exit silently without printing a backtrace, and return code 0. Seems to happen on both 1.7.1 and 2.0.1.