[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2009-05-12 Thread Daniel Diniz

Daniel Diniz  added the comment:

You're right, sorry about the noise. Closing as out of date.

--
resolution:  -> out of date
stage: test needed -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2009-05-12 Thread Skip Montanaro

Skip Montanaro  added the comment:

Daniel> Daniel Diniz  added the comment:

Daniel> I get different behavior in py3k compared to trunk:

Daniel> ~/trunk-py$ ./python issue1511_py3k.py
Daniel> [['foo', 'bar\r\nbaz\r\nbiff', 'boo']]
Daniel> 'foo,"bar\r\nbaz\r\nbiff",boo\r\n'

Daniel> ~/trunk-py$ ../py3k/python issue1511_py3k.py
Daniel> [['foo', 'bar\nbaz\nbiff', 'boo']]
Daniel> 'foo,"bar\nbaz\nbiff",boo\n'

Try adding newline='' to your open calls.  I believe that will preserve the
CRLF pairs.

Skip

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2009-05-12 Thread Daniel Diniz

Daniel Diniz  added the comment:

I get different behavior in py3k compared to trunk:

~/trunk-py$ ./python issue1511_py3k.py
[['foo', 'bar\r\nbaz\r\nbiff', 'boo']]
'foo,"bar\r\nbaz\r\nbiff",boo\r\n'

~/trunk-py$ ../py3k/python issue1511_py3k.py
[['foo', 'bar\nbaz\nbiff', 'boo']]
'foo,"bar\nbaz\nbiff",boo\n'

--
components: +IO
nosy: +ajaksu2, pitrou
stage:  -> test needed
versions: +Python 2.6 -Python 2.4
Added file: http://bugs.python.org/file13970/issue1511_py3k.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2008-01-20 Thread Christian Heimes

Changes by Christian Heimes:


--
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2007-11-28 Thread Skip Montanaro

Changes by Skip Montanaro:


--
assignee:  -> skip.montanaro
nosy: +skip.montanaro

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2007-11-27 Thread Gregory P. Smith

Gregory P. Smith added the comment:

attaching the test input file.  use od -x or similar to compare the
new.csv output with issue1511.csv to see if the problem happened.

its 2.4.. that may be old enough to be considered dead

Added file: http://bugs.python.org/file8817/issue1511.csv

__
Tracker <[EMAIL PROTECTED]>

__foo,"bar
baz
biff",boo
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2007-11-27 Thread Gregory P. Smith

Gregory P. Smith added the comment:

release25-maint and trunk (2.6) appear to do the correct thing when
testing on my ubuntu gutsy linux x86 box.  test script and file attached.

The problem is reproducable in a release24-maint build compiled 2007-11-05.

--
nosy: +gregory.p.smith
Added file: http://bugs.python.org/file8816/issue1511.py

__
Tracker <[EMAIL PROTECTED]>

__

issue1511.py
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2007-11-27 Thread Bill Fenner

Bill Fenner added the comment:

I realized that my description was not crystal clear - the file being 
read has \r\n line terminators - in the format that I used later, the 
input file is

foo,"bar\r\n
baz\r\n
biff",boo\r\n

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2007-11-27 Thread Bill Fenner

Changes by Bill Fenner:


--
components: +Library (Lib)

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks

2007-11-27 Thread Bill Fenner

New submission from Bill Fenner:

When a field has internal line breaks, e.g.,

foo,"bar
baz
biff",boo

that is actually 3 lines, but one csv-file row.  csv.reader() converts 
this to ['foo', 'bar\nbaz\nbiff', 'boo'].  This is a reasonable 
behavior.

Unfortunately, csv.writer() does not use the dialect's lineterminator 
setting for values with such internal linebreaks.  This means that the 
resulting file will have a mix of line-termination styles:

foo,"bar\n
baz\n
biff",boo\r\n

If the reading csv implementation is strict about its line termination, 
these line breaks will not be read properly.

--
messages: 57902
nosy: fenner
severity: normal
status: open
title: csv input converts \r\n to \n but csv output does not when a field has 
internal line breaks
type: behavior
versions: Python 2.4

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com