Hi, I have a question about uploading and reading text files. I'll explain a slightly simplified version of the problem and what I'm trying to do in broad details, and then explain where I'm having difficult with the code in web2py. If you're not interested in the background, skip the next two or three paragraphs.
I have two database tables. One is a list of locations with columns like id,lat,lng,name,etc. The other is a record of measurements at those locations in the form of id,locationid,measurement,datetime. Until now, we just use pen and paper. An employee gets a list of locations, goes to visit each of them, writes down the measurements, and then types them into a form at the end of the day. We got some new devices with integrated GPS. Now, the employee can go visit a location and record the measurement in their device. At then end of the day, they have a csv in the form of lat,lng,measurement,datetime. I want to be able to upload that csv to our system, match up the lat,lng pairs from the csv with the closest distance locationid from the location table, and record the measurement in the measurement table after displaying a confirmation/verification screen. So, I'm specifically running into problems with the file upload and reading it. I've looked through the web2py book, but all of the documentation that I see is related to uploading data and storing it in a database column or uploading csvs to a table. I don't want to store my csvs from the device to a database-- I just want to read them into memory as a list and work with them from there. So, right now, I've got a very simple form like so-- form = FORM(INPUT(_type='file', _name='data'), INPUT(_type='submit')) after upload, it looks like I get a file handle stored in form.vars.data, but I get exceptions if I try to open it, and I'm told it's non-iterable if I try to iterate over it. How can I read this file and get the data into a string or a list? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

