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 matplotlib.cbook import to_filehandle print 'Opening a \\r\\n file (good on my system):' fh = to_filehandle('triangleplot_demo.csv') soilrec=csv2rec(fh) print soilrec.dtype print 'Opening a \\r file (bad on my system):' fh = to_filehandle('triangleplot_demo2.csv') soilrec=csv2rec(fh) print soilrec.dtype
triangleplot_demo.csv
Description: Binary data
triangleplot_demo2.csv
Description: Binary data
thanks! On Jan 25, 2009, at 1:27 PM, John Hunter wrote:
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 idea, but I can't figure out how to specify that in/with/before calling csv2rec.Perhaps you can post the file so we can take a look? FYI, you can pass a file handle in to csv2rec, so if you need to open the file in some special mode, do so and pass csv2rec the file handle rather than file name. JDH
Chloe Lewis Graduate student, Amundson Lab Division of Ecosystem Sciences, ESPM University of California, Berkeley 137 Mulford Hall - #3114 Berkeley, CA 94720-3114 chle...@nature.berkeley.edu
------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users