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

Csv files should be opened with universal new line mode #127

Closed
gone opened this issue Aug 10, 2014 · 8 comments
Closed

Csv files should be opened with universal new line mode #127

gone opened this issue Aug 10, 2014 · 8 comments

Comments

@gone
Copy link

gone commented Aug 10, 2014

When attempting to open a file saved on a windows computer import-export throw an error:

Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?

It looks like U needs to be added to the open call - see http://stackoverflow.com/questions/17315635/csv-new-line-character-seen-in-unquoted-field-error

@bmihelac
Copy link
Member

Thanks for report. We do open csv as 'rU' but only for PY3. Here is a link to code:

https://github.com/bmihelac/django-import-export/blob/master/import_export/formats/base_formats.py#L110

To be honest I am not sure why is binary used for python 2.X here. This should be inspected carefully so we do not fix one issue and open another.

@gmehta-personal
Copy link

Is there a work around for 2.x? Any recommendations?

@chriswait
Copy link

Hi bmihelac, has any progress been made with this issue?

Many thanks,
a python 2.x user

@marksweb
Copy link
Contributor

marksweb commented Dec 9, 2014

Any word on this?

I'm using Python 2.7.5 & cannot work with Excel files due to this error. I essentially have to have clients email me their CSV, save as CSV in Open Office & then do their import for them.

@litchfield
Copy link

Yes there should be an option to support universal (and frankly, I'd have thought that should've been the default option)

@bmihelac
Copy link
Member

@litchfield thanks for contribution.

I am thinking of treating CSV as text and not binary python2. I am not sure why it is opened as binary and cannot find any documentation regarding this.

Also I do not think there is needed additional setting as this should be a bugfix. Do you agree?

This would be achieved by removing following lines:

https://github.com/django-import-export/django-import-export/blob/master/import_export/formats/base_formats.py#L128-L133

I just need to make csv with office on windows to make sure it does not break anything.

@litchfield
Copy link

Cool, yes a fix would be even better @bmihelac

bmihelac added a commit that referenced this issue Sep 14, 2015
@jdotjdot
Copy link

jdotjdot commented Oct 1, 2015

When will this get released to PyPI?

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

7 participants