Error in reading and writing CSV format file in python

inshu chauhan insideshoes at
Mon Feb 11 12:00:12 CET 2013

In the programme below I am trying to read two csv format files and process
them and write a new file with some of theirs data.

import csv
f1_reader = csv.reader(open(r"Z:\Weka
f2_reader = csv.reader(open(r"Z:\Weka
nf = open(r"Z:\Weka work\classified_image00_withoutxy.arff", "w")

while True:
    l1 =
    while len(l1) != 12:
        l1 =
    l2 =
    while len(l2) != 11:
        l2 =

    ix = l1[0].strip()
    iy = l1[1].strip()
    classification = l2[8].strip()

    print >> nf, ix, iy, classification


This programme is giving me this error now :

Traceback (most recent call last):
  File "Z:\Weka work\", line 16, in
    l2 =

what could be a possible reason to StopIteration ???

I checked the syntax and usage of this module looks alright to me , but
then why this error ?

Thankyou in Advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list