On Jan 6, 1:41 am, Ian Kelly <ian.g.ke... at gmail.com> wrote: > One could also avoid creating the intermediate file by using a > StringIO to keep it in memory instead: Yes StringIO is perfect for this. Many thanks to all who replied.