On Wed, Sep 16, 2009 at 6:33 PM, Bo Jangeborg <b...@softwave.se> wrote:
> claudio canepa skrev: > >> >> >> On Wed, Sep 16, 2009 at 5:18 PM, Bo Jangeborg <b...@softwave.se <mailto: >> b...@softwave.se>> wrote: >> >> >> a ha >> Well, from where comes event ? >> >> >> event = pyg_event.poll() >> >> but note that a long can't have attributes and 13 lines above the >> error point I do : >> >> mouse_pos = event.pos >> >> and it works at that time >> >> >> pyg_event.poll is pygame.event.poll ? >> > Yes > > If the only fountain for events were the pygame event queue, the traceback >> coulnt happen: >> >> a) >> elif event.type is MOUSEBUTTONUP: >> -> dont, raises, so is not a long >> >> b) the flow comes to >> _,_,_ = self.mouse_button_up(event, mob_pos, mousemove) >> >> c)into method mouse_button_up event will become a local variable. That >> variable is not assigned, at least in the code you show here. >> d) the flow progress to the line >> if event.button == 1: >> where it raises AttributeError: 'long' object has no attribute 'button' >> >> I see two possibilities here: >> >> 1. You snipped some code where event is assigned >> >> No , you can see all the code, and event is not being assigned to. > >> 2. ( wild possibility) the functions called in mouse_button_up will >> produce a *second* call with other parameters to the same function, and that >> call has a wrong event parameter. But, why the traceback not show additional >> calls in that case? >> > No , there are no such recursive calls to mouse_button_up > besides if the incoming event parameter was a long it should fail at > mouse_pos = event.pos > > My guess is that there is something over writing the event object at a > lower level, possibly > caused by something I am doing. > Bo) > well, there is code after mouse_pos = event_pos. I would add a assert type(event) is not long after any function call in mouse_button_up to know when event is changed, then drill down the offending function. -- claxo