Namespace problem?
Josh English
joshua.r.english at gmail.com
Thu Jul 1 18:07:53 EDT 2010
On Jul 1, 2:50 pm, Matt McCredie <mccre... at gmail.com> wrote:
>
> That doesn't give me enough information to help you with the issue. In general
> you need to provide enough code to reproduce the failure, not some modified
> version that doesn't fail. 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. But what do I
> know, that is just a guess.
>
> Matt
This is the code snippet with more context, but it isn't runnable
without creating a bunch of dummy objects:
# data is a dictionary. The keys are student names, the values are
Tracker object.
# The tracker class defines the method hasFWS() which returns a
boolean.
# _monthnumbers is a list: [7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6]
I just cut out the code that doesn't have anything to do the variable
fws_last_col
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
More information about the Python-list
mailing list