Hi, my app is a Pyrobot (http://emergent.brynmawr.edu/~dblank/pyro/) simulation which connects to PlayerStage (playerstage.sf.net) to simulate three Pioneer robots. These are controlled using NeedBrain.py. In parallel to the three NeedBrains there is one MonitorBrain running for some management tasks, so I have four parallel running classes.
NeedBrain.py -> http://deadbeefbabe.org/paste/762 MonitorBrain.py -> http://deadbeefbabe.org/paste/763 I added assertion code, which shows that I am comparing real floats. Nevertheless, I get: NeedBrNeedBrain.py:232: RuntimeWarning: tp_compare didn't return -1 or -2 for exception assert type(self._markerDist)==type(1.0), str(self._markerDist)+"is not float" Traceback (most recent call last): File "NeedBrain.py", line 232, in update assert type(self._markerDist)==type(1.0), str(self._markerDist)+"is not float" IndexError: tuple assignment index out of range Locals by frame, innermost last Frame __bootstrap in /usr/lib/python2.3/threading.py at line 436 self = <NeedBrain(Thread-4, started)> Frame run in /home/wr/forschung/software/ps/pyrobot/brain/__init__.py at line 148 count = 0 self = <NeedBrain(Thread-4, started)> Frame step in NeedBrain.py at line 465 self = <NeedBrain(Thread-4, started)> Frame step in /home/wr/forschung/software/ps/pyrobot/brain/behaviors/__init__.py at line 63 s = ApproachMarker20Action self = <NeedBrain(Thread-4, started)> Frame run in /home/wr/forschung/software/ps/pyrobot/brain/behaviors/__init__.py at line 299 r = [1.0, 'rotate', -2.2425874250672049, 'Rule2', 'MoveToMarkerBehavior', 'ApproachMarker20Action'] b = <NeedBrain.AvoidObstacleBehavior instance at 0xb63f13cc> bkey = AvoidObstacleBehavior self = <NeedBrain.ApproachMarker20Action instance at 0xb63ececc> Frame update in NeedBrain.py at line 237 self = <NeedBrain.ApproachMarker20Action instance at 0xb63ececc> e = tuple assignment index out of range Any comment to the code is appreciated - especially those ones that solve the IndexError ;-) Regards, wr Am Mittwoch, 1. Juni 2005 19:09 schrieb Danny Yoo: > On Wed, 1 Jun 2005, Willi Richert wrote: > > in my code I get in rare occasions an IndexError which is > > incomprehensible to me in that situation, where I do a simple > > comparison: > > > > NeedBrain.py:233: RuntimeWarning: tp_compare didn't return -1 or -2 for > > exception > > self._isNearMarker = self._markerDist < self.STAY_MIN_DIST > > Hi Willi, > > Hmmm! This actually looks very unusual. You should never see anything > about 'tp_compare' unless you're dealing with a buggy C extension. > > > Traceback (most recent call last): > > File "NeedBrain.py", line 233, in update > > self._isNearMarker = self._markerDist < self.STAY_MIN_DIST > > IndexError: tuple assignment index out of range > > > > I don't see, where tuples are involved. I only compare two floats. I've > > Python 2.3.4. > > Have you edited the program since the program started? It's very possible > that the line numbers are wrong just because the program has changed in > the meantime. > > But the warning before that talks about 'tp_compare' has me intrigued, as > you should never see that error. If you don't mind, can you post your > code up somewhere? > > > Best of wishes to you! > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor