Hi, I'm trying to create a CSV view for a set of rows. Here's the code for the view:
{{import StringIO, csv}} {{outfile = StringIO.StringIO()}} {{mywriter = csv.writer(outfile, dialect=csv.excel_tab)}} {{mywriter.writerow(['Name', 'Address', 'City', 'State'])}} {{for row in places:}} {{mydata = [row.plads.name, row.plads.address, row.plads.city, row.plads.state.state]}} {{mywriter.writerow(mydata)}} {{pass}} {{response.headers['Content-Disposition'] = 'attachment; filename= %s.csv' %(routeinfo.name)}} {{response.write(outfile.getvalue(), escape=True)}} {{outfile.close()}} This generates a csv file, but when I open it with excel, there are several blank lines before the usable data. The only rhyme or reason I see to it, is that the number of leading blank lines is about 3.2x the number of rows. So, when I have 30 rows (two different sets of 30 rows), there are 96 leading blank lines. 27 rows gets me 87 leading lines, and 19 rows gets me 63. If I open the file with Emacs or try to import for MapPoint, I still get the leading blank lines. If I open the file with Notepad, the leading lines are not present. I think this has something to do with the newline character. The server is running Debian, and the clients are on Windows. Anyone have any ideas for how to solve this?