On 01/07/2010 22:30, Josh English wrote:
I have a script that generates a report from a bunch of data I've been
collecting for the past year. I ran the script, successfully, for
several weeks on test runs and creating more detailed reports.

Today (back from vacation) and the script doesn't work. It's giving me
a name error.

I'm running python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.
1310 32 bit (Intel)]. (Upgrading is not a possibility right now.
Eventually we'll be upgraded top Windows 7.)

Here is the reduced code:

fws_first_col = 6

So fws_first_col is set to 6.


for student in range(32):

student isn't used in the snippet below.


     if True:

Isn't this always going to run?

         idx = fws_first_col

Effectively set idx to 6 each time around the for loop.


         for _month in range(12):
             idx += 2

Add 24 to idx each time around the for loop.  24 + 6 == 30.

         fws_last_col = idx

set fws_last_col to 30 each time around the for loop.



print fws_last_col

prints 30 only once.


I get:

NameError: name 'fws_last_col' is not defined

This snippet of code works on it's own, but not in the main script. I
know it looks funny, but this should preserve the appropriate nesting
of things.

Certainly doesn't look at all correct to me.


Where else could I look to find this problem?

In a mirror? :)

Kindest regards.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to