[wingide-users] StopIteration exception reported as uncaught

stephane martin stef.martin at gmail.com
Tue Feb 21 13:37:48 EST 2006


Hi !

I face quite a strange situation with the StopIteration exception
being declared uncaught in the wingide editor.

Take the following piece of code.



*****************
import UserDict

class iterable(object):

    def __init__(self):
        self.__data__=[7,8,9]
    def __repr__(self):
        return repr(self.__data__)

    def __str__(self):
        return str(self.__data__)

    def __iter__(self):
        n=0
        while True:
            try:
                suiv=self.__data__[n]
                n+=1
            except IndexError:
                raise StopIteration
            else:
                yield suiv

    def test(self):
        return self.__iter__()

a=iterable()
zob=a.test()
print list(zob)

*****************



It executes smoothly with the python interpretor




*****************
[7,8,9]
*****************

In the wingide editor, when i click on Debug, it summons the Exception
tab and reports an uncaught exception:

*****************
StopIteration:

Traceback (innermost last):

File "c:\Documents and Settings\ZRA31J.AD\Mes documents\test.py", line 1, in ?
  import UserDict
File "c:\Documents and Settings\ZRA31J.AD\Mes documents\test.py", line 29, in ?
  print list(zob)
File "c:\Documents and Settings\ZRA31J.AD\Mes documents\test.py", line
20, in __iter__
  raise StopIteration
*****************


Is it a known bug ???


My config:

x86 family 15 model 2 stepping 9, genuineintel
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
Wing IDE Professional 2.0.4-1


More information about the wingide-users mailing list