[New-bugs-announce] [issue8387] use universal newline mode in csv module examples

sfinnie report at bugs.python.org
Tue Apr 13 23:11:26 CEST 2010


New submission from sfinnie <scott.finnie at gmail.com>:

Running the examples in the csv module docs (http://docs.python.org/library/csv.html) causes problems reading file on a mac.  This is highlighted in issue 1072404 (http://bugs.python.org/issue1072404).

Commentary on the bug indicates a no fix, meaning most/many people using a mac will get an error if they use the sample code in the docs.

A simpler solution would be to use universal newline mode in the doc examples.  This is actually mentioned in commentary on the bug, and appears to work.

Proposal
--------
In all example code blocks, use mode 'rU' when opening the file.  1st code block, for example, would become:

spamReader = csv.reader(open('eggs.csv', 'rU'), delimiter=' ', quotechar='|')

That should solve the problem on mac without impacting compatibility on other operating systems.  Note: Haven't been able to verify this on other platforms.

----------
assignee: georg.brandl
components: Documentation
messages: 103086
nosy: georg.brandl, sfinnie
severity: normal
status: open
title: use universal newline mode in csv module examples
type: feature request
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8387>
_______________________________________


More information about the New-bugs-announce mailing list