python stdin flush invalid argument