fix #643 Python Error on Cancelling Print