python script wrote to wrong file