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.reader Error message indicates to use deprecated #70835
Comments
Currently, the error message: _csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? is cryptic in that universal line mode has been deprecated, and will not run in Python 3.5., i.e.:
open(escape_path, "rU", encoding=ENCODING)
>>> DeprecationWarning: 'U' mode is deprecated I think a message indicating a suggestion to open the file with newline='' to enable universal line mode is more insightful. |
While the 'U' mode has been deprecated it doesn't mean that your example doesn't run in 3.5 - it runs just fine and will keep doing so until 4.0 I'm attaching patch that suggests using newline=None (even though it's a default value for open), as that what seems to better correspond to the old 'U' mode. |
Isn’t using newline=None a way to produce the error in the first place? Silent Ghost: see the footnote <https://docs.python.org/3/library/csv.html#id3\>. Reading with newline=None translates newlines. Writing with newline=None produces CRLFs on Windows. I understand the CSV module wants neither of these translations, so it has full control of the code points. |
Ah, the bit about csv module doing it's own newline handling is what I missed. Here is the updated patch. |
When this error is triggered at all? |
…newline Based on patch by SilentGhost.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: