[docs] [issue19136] CSV, builtin open(), newline arg. Docs broken again.
Graham Wideman
report at bugs.python.org
Tue Oct 1 09:14:23 CEST 2013
New submission from Graham Wideman:
The docs appear to be incorrect for CSV at: http://docs.python.org/3.3/library/csv.html.
Per issue http://bugs.python.org/issue7198 , there's a long history of contention between os.open and csv.writer, in which, on Windows, the default result is an unwanted additional '\r'. That was 'fixed' by using the newline='' argument to open().
This is reflected in the docs at the above link:
with open('eggs.csv', 'w', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=...)
However, in python 3.3.2 use of the newline argument returns: "TypeError: 'newline' is an invalid keyword argument for this function."
In brief testing, it appears that a correct result can be obtain by calling open as follows:
with open(somepath, 'wb') as writerfile:
writer = csv.writer(writerfile, delimiter=...)
Note: binary mode, not text as previously needed and currently documented.
----------
assignee: docs at python
components: Documentation
messages: 198752
nosy: docs at python, gwideman
priority: normal
severity: normal
status: open
title: CSV, builtin open(), newline arg. Docs broken again.
type: behavior
versions: Python 3.3, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19136>
_______________________________________
More information about the docs
mailing list