Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-02-05 Thread Christopher Barker
Jeff et al: I submitted a bug report about universal newline support in the gzip module. It's been fixed. Much thanks to Skip Montanaro: http://bugs.python.org/issue5148 I have no idea if this issue exists in the zip module and/or py3k, but it's a start. Of course, we can't count in it for

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Jeff Whitaker
John Hunter wrote: On Wed, Jan 28, 2009 at 2:11 PM, Christopher Barker chris.bar...@noaa.gov wrote: But why the heck not? and according to the OP, Excel does create such files. Personally, I try to ALWAYS use 'U' when opening text files -- it can save headaches, and I see no downside.

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Christopher Barker
Jeff Whitaker wrote: John: 'rU' apparently doesn't work for gzipped text files (at least in python 2.5.2). I had to change the default in back to 'r' when using gzip.open (r6846 in trunk). darn -- sounds like a bug/missing feature in the gzip module. Strange , though, unknown flags seem

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Christopher Barker
C Lewis wrote: So one argument is that there's no good reason to risk breaking old defaults, As far as I can see, this won't break any code, though -- Universal newlines won't change anything with native newlines anyway. except maybe with the gzip module... -Chris -- Christopher Barker,

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Christopher Barker
here are my test files -- just to save you a minute if you want to try it yourself. -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Christopher Barker
Christopher Barker wrote: here are my test files -- just to save you a minute if you want to try it yourself. oops -- the email process fixed the mixed newlines in test_newlines.txt! At least with my client. It's probably work if you unpack the gz though. -Chris -- Christopher Barker,

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Jeff Whitaker
Christopher Barker wrote: Jeff Whitaker wrote: John: 'rU' apparently doesn't work for gzipped text files (at least in python 2.5.2). I had to change the default in back to 'r' when using gzip.open (r6846 in trunk). darn -- sounds like a bug/missing feature in the gzip module. Strange

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Christopher Barker
Jeff Whitaker wrote: Chris: Here's a self-contained example of the problem (data file attached): yup -- I get the same problem. Interesting, I thought it might be an issue with the 'U' flag creating a difference in byte offset, but that's a unix style file already, so it should make no

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Christopher Barker
getting carried away here... I took a look at the Python SVN (2.5.4 and 2.6.1) for the gzip lib. I see this: # guarantee the file is opened in binary mode on platforms # that care about that sort of thing if mode and 'b' not in mode: mode += 'b'

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-29 Thread Jeff Whitaker
Christopher Barker wrote: Jeff Whitaker wrote: Chris: Here's a self-contained example of the problem (data file attached): yup -- I get the same problem. Interesting, I thought it might be an issue with the 'U' flag creating a difference in byte offset, but that's a unix style file

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-28 Thread Christopher Barker
John Hunter wrote: On Mon, Jan 26, 2009 at 1:10 PM, Christopher Barker Shouldn't csv2rec open files in Universal mode by default anyway? The only down side I can see to this is universal support can be disabled at build time, though it is on by default. At least this is my interpretation

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-28 Thread John Hunter
On Wed, Jan 28, 2009 at 2:11 PM, Christopher Barker chris.bar...@noaa.gov wrote: But why the heck not? and according to the OP, Excel does create such files. Personally, I try to ALWAYS use 'U' when opening text files -- it can save headaches, and I see no downside. It really should be the

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-26 Thread Christopher Barker
John Hunter wrote: OK, I can reproduce the problem and the solution is easy. Open the file in universal mode and pass the file handle to csv2rec:: Shouldn't csv2rec open files in Universal mode by default anyway? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-26 Thread John Hunter
On Mon, Jan 26, 2009 at 1:10 PM, Christopher Barker chris.bar...@noaa.gov wrote: John Hunter wrote: OK, I can reproduce the problem and the solution is easy. Open the file in universal mode and pass the file handle to csv2rec:: Shouldn't csv2rec open files in Universal mode by default

[Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-25 Thread C Lewis
In matplotlib.mlab.csv2rec in 0.91.2 (*) headers = reader.next() fails with Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? Which sounds like a good idea, but I can't figure out how to specify that in/with/before calling

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-25 Thread John Hunter
On Sun, Jan 25, 2009 at 3:23 PM, C Lewis chle...@nature.berkeley.edu wrote: In matplotlib.mlab.csv2rec in 0.91.2 (*) headers = reader.next() fails with Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? Which sounds like a good

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-25 Thread C Lewis
Tiny case appended. On my system (OS X), csv2rec() of the first file is fine, csv2rec() of the second fails with the mentioned error; they only differ in newline characters. Inconveniently, the one that fails seems to be Excel's default export. from matplotlib.mlab import csv2rec from

Re: [Matplotlib-users] universal_newline in matplotlib 0.91.2?

2009-01-25 Thread John Hunter
On Sun, Jan 25, 2009 at 3:59 PM, C Lewis chle...@nature.berkeley.edu wrote: Tiny case appended. On my system (OS X), csv2rec() of the first file is fine, csv2rec() of the second fails with the mentioned error; they only differ in newline characters. Inconveniently, the one that fails seems to