>Isn't universal newlines only used for reading?
That right. And the CSV reader has it's own version of univeral newlines
anyway (from the py1.5 days).
>I have had no problems using the csv module for reading files with
>universal newlines by opening the file myself or providing an iterator.
Ne
On Jan 12, 2005, at 21:39, Skip Montanaro wrote:
Jack> On MacOSX you really want universal newlines. CSV files
produced
Jack> by older software (such as AppleWorks) will have \r line
Jack> terminators, but lots of other programs will have files with
Jack> normal \n terminators.
Wo
Jack> On MacOSX you really want universal newlines. CSV files produced
Jack> by older software (such as AppleWorks) will have \r line
Jack> terminators, but lots of other programs will have files with
Jack> normal \n terminators.
Won't work. You have to be able to write a Windows
>> The idea of the check is to enforce binary mode on those objects that
>> support a mode if the desired line terminator doesn't match the
>> platform's line terminator.
Andrew> Where that falls down, I think, is where you want to read an
Andrew> alien file - in fact, under u
On 12-jan-05, at 2:59, Skip Montanaro wrote:
terminators = {"darwin": "\r",
"win32": "\r\n"}
if (dialect.lineterminator != terminators.get(sys.platform, "\n")
and
"b" not in getattr(f, "mode", "b")):
raise IOError, ("%s not opened in binary mode" %
>You can argue that reading csv data from/writing csv data to a file on
>Windows if the file isn't opened in binary mode is an error. Perhaps we
>should enforce that in situations where it matters. Would this be a start?
>
>terminators = {"darwin": "\r",
> "win32": "\r\n"}
>