Namespace problem?

Josh English joshua.r.english at gmail.com
Thu Jul 1 17:30:54 EDT 2010


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

for student in range(32):

    if True:
        idx = fws_first_col

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


print fws_last_col

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.

Where else could I look to find this problem?



More information about the Python-list mailing list