On Thu, 01 Jul 2010 23:07:53 +0100, Josh English <joshua.r.engl...@gmail.com> wrote:

On Jul 1, 2:50 pm, Matt McCredie <mccre...@gmail.com> wrote:

My guess is that the "if True" is actually something
else, and it isn't being interpreted as "True". As such, "fws_last_col" never gets assigned, and thus never gets created. You can fix that by assigning
fws_last_col to an appropriate default value before the for loop.

[snip]
fws_first_col = 6

for student in sorted(data.keys() ):
    #~ print student

    tracker = data[student]

    if tracker.hasFWS():

        idx = fws_first_col


        for _month in iter(_monthnumbers):
            idx += 2
        fws_last_col = idx

        fws_month_count_col = idx + 4
        fwsrow += 1

print fws_last_col

[I snipped the explanations for brevity]

If this is a version of your code that actually fails when you run it (rather than being another artistic interpretation of a photograph of your code :-), then I'd go with Matt's analysis. This will give you a NameError for fws_last_col if tracker.hasFWS() happens to return False for all students.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to