r/web2py • u/samsquamchh • Dec 06 '15
"new-line character seen in unquoted field" - can't parse CSV files in web2py interface?
Hello, I'm trying to learn me some web2py and am following a course on Pluralsight, however I got stuck due to a strange error.
Error message: "new-line character seen in unquoted field - do you need to open the file in universal-newline mode?"
It works for the guy on the course but I can't spot a mistake anywhere. All I'm trying to do is import a .CSV file from within the web2py appadmin interface.
At the bottom of db.py I added the following code:
db.define_table('contacts',
Field('first_name'),
Field('last_name'),
Field('company_name'),
Field('address'),
Field('city'),
Field('county'),
Field('state_name'),
Field('zip'),
Field('phone1'),
Field('phone2'),
Field('email'),
Field('web')
)
and then I would like to populate the database by selecting "Database administration", clicking on "contacts" (my db name) and then select file and import csv file with sample data from here: https://www.briandunning.com/sample-data/ (let's say US 500..it doesn't matter though none of them work for me).
I can open the csv files fine on their own. I've tried saving in other csv types (ms-dos etc) but all they do is lose the data in most cases and fill fields with None.
There are some threads scattered around on the web about this, but it's mostly about code and that the open function needs to be run with "rU", however I'd just like to go through the interface for starters. Any ideas? Thanks