Konrad Hofbauer wrote:
Hello,

I try to import the attached simple csv file into Lyx, but csv2lyx fails with:

$ python /Applications/LyX-1.6.0rc2.app/Contents/Resources/scripts/csv2lyx.py NoiseResult.csv Traceback (most recent call last): File "/Applications/LyX-1.6.0rc2.app/Contents/Resources/scripts/csv2lyx.py", line 162, in ?
    num_rows = reader.line_num # number of lines
AttributeError: '_csv.reader' object has no attribute 'line_num'

Looks like a bug to me. Can somebody take a look at it?
Both with 1.5.6 and 1.6.0rc2 on Mac.

Works here. I'm guessing maybe you have an older version of python? I think line_num may only have come into being with python 2.5 (see here: http://docs.python.org/whatsnew/modules.html). If so, probably we shouldn't use that but should instead the attached patch.

rh

Index: csv2lyx.py
===================================================================
--- csv2lyx.py	(revision 26442)
+++ csv2lyx.py	(working copy)
@@ -159,7 +159,7 @@
     num_cols = max(num_cols, len(row))
     rows.append(row)
 
-num_rows = reader.line_num # number of lines
+num_rows = len(rows) # number of lines
 
 # create a LyX file
 #####################

Reply via email to