[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Getting unknown error



On Sunday 04 November 2007 19:11:28 Eric Hunter wrote:
> I've never heard of this error before: UnboundLocalError: local variable
> 'rect' referenced before assignment

Your problem is in the line "rect = pickle.load(self.in_file)"  When you 
assign to a name inside of a function, that name is considered to be local to 
that function, even before it is assigned.  Add "global rect" to the 
beginning of MainLoop and it'll be treated as a global.

MWM