local variable referenced before assignment

Pete Bartonly none at try.invalid
Thu Oct 25 05:02:24 EDT 2007


Quick question, probably quite a simple matter. Take the follow start of 
a method:


def review(filesNeedingReview):

     for item in filesNeedingReview:
         (tightestOwner, logMsg) = item

         if (logMsg != None):
             for logInfo in logMsg.changed_paths:


This generates the error:

   UnboundLocalError: local variable 'logMsg' referenced before assignment

I thought I'd assigned it in the "(tightestOwner, logMsg) = item" line - 
so in the python interpreter complaining about the fact this assignment 
might not go well?

Thanks!



More information about the Python-list mailing list