Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't cope with non-universal newlines #29

Open
DASpringate opened this issue Sep 24, 2014 · 1 comment
Open

Can't cope with non-universal newlines #29

DASpringate opened this issue Sep 24, 2014 · 1 comment

Comments

@DASpringate
Copy link
Member

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?

@DASpringate
Copy link
Member Author

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant