csv file import only takes values of last row

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • biscayne
    New Member
    • Nov 2012
    • 1

    csv file import only takes values of last row

    When trying to load csv file data into Scribus it only takes the data of the last row.
    I'm using ScribusGenerato r.py by Ekkehard Will and my best guess is that the cause of the problem somewhere in this part of the code:

    Code:
    def replaceVariablesWithCsvData(self, headerRow, row, lines): # lines as list of strings
            result = ''
            for line in lines:
                i = 0
                for cell in row:
                    tmp = ('%VAR_' + headerRow[i] + '%')
                    line = line.replace(tmp, cell) # string.replace(old, new)
                    i = i + 1
                result = result + line
            return result
             
    def getCsvData(self, csvfile):
            # Read CSV file and return  2-dimensional list containing the data
            reader = csv.reader(file(csvfile))
            result = []
            for row in reader:
                rowlist = []
                for col in row:
                    rowlist.append(col)
                result.append(rowlist)
            return result
    Last edited by zmbd; Nov 13 '12, 11:50 AM. Reason: [z{Please remember to format code using the <CODE/> formatting button.}]
Working...