Open DASpringate opened 10 years ago
http://stackoverflow.com/questions/17315635/csv-new-line-character-seen-in-unquoted-field-error
fix: replace
codereader = csv.reader(infile, delimiter = str(form_data["delimiter"]))
with
codereader = csv.reader(infile.read(),splitlines()) delimiter = str(form_data["delimiter"]))
Should do it...
Traceback (most recent call last):
File "/webapps/envs/medcodes/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, _callback_args, *_callback_kwargs)
File "/webapps/envs/medcodes/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view return view_func(request, _args, *_kwargs)
File "/webapps/envs/medcodes/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view response = view_func(request, _args, *_kwargs)
File "/webapps/medcodes/medcodes/apps/codesdb/views.py", line 268, in upload_codelist codelist_to_db(codelist_file, article_id, form.cleaned_data)
File "/webapps/medcodes/medcodes/apps/codesdb/io.py", line 81, in codelist_to_db headings = codereader.next()
Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?