But this is purely addition - there's no call to sys.stdout.write here in the current code, so the display of the exception in the current situation must happen somewhere else.