You're getting this issue because csv.reader's first argument takes an object that supports the iterator interface, as documented here:
http://docs.python.org/library/csv.html
The call to open() in that document returns a file, not a String instance:
http://docs.python.org/library/functions.html#open The call self.request.get('csv') returns a String. When you iterate over a string, you iterate over the characters, not the lines. You can see the difference here:
class ProcessUpload(webapp.RequestHandler):
def post(self):
self.response.out.write(self.request.get('csv'))
file = open(os.path.join(os.path.dirname(__file__), 'sample.csv'))
self.response.out.write(file)
# Iterating over a file
fileReader = csv.reader(file)
for row in fileReader:
self.response.out.write(row)
# Iterating over a string
fileReader = csv.reader(self.request.get('csv'))
for row in fileReader:
self.response.out.write(row)
--
Ikai Lan
Developer Programs Engineer, Google App Engine