Winge IDE Issue - an suggestions?

Discussion in 'Python' started by Mike Thompson, Dec 16, 2004.

  1. I've run into a problem using WingIDE. I have a dead simple script
    (which uses ElementTree):


    from elementtree.ElementTree import Element, SubElement, tostring
    e = Element("Outer")
    sub = SubElement(e, 'Version').text = "v1.0"
    print tostring(e)


    When I run this script from the command line, it works (as it should) -
    an XML document is printed.

    BUT, when I load this script into Winge IDE and run this under the
    debugger, I get an exception which appears completely bogus (but does
    always happen in the same place every time, at least):


    IndexError: list index out of range

    Traceback (innermost last):

    File "C:\MediaWise\src\MCN_Wizard_Exe\test.py", line 1, in ?
    from elementtree.ElementTree import Element, SubElement, tostring
    File "C:\MediaWise\src\MCN_Wizard_Exe\test.py", line 6, in ?
    print tostring(e)
    File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line
    924, in tostring
    ElementTree(element).write(file, encoding)
    File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line
    666, in write
    self._write(file, self._root, encoding, {})
    File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line
    710, in _write
    self._write(file, n, encoding, namespaces)
    File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line
    709, in _write
    for n in node:
    File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line
    227, in __getitem__
    return self._children[index]


    The exception is triggered in ElementTree but the code is fine.
    Something about the Wing IDE debuger is causing this exception to be
    thrown.

    Does anyone have any insight? WingIDE looks pretty good to me, so I'm
    disappointed to find this problem.

    I've reported the problem to wingware.com, but I need to keep going, so
    I thought I'd ask here for clues.

    I'm using WingIDE 2.0.1-1, Professional on Windows XP. Py2.3.3

    --
    Mike
    Mike Thompson, Dec 16, 2004
    #1
    1. Advertising

  2. Mike Thompson wrote:

    >
    > I've run into a problem using WingIDE. I have a dead simple script
    > (which uses ElementTree):
    >
    >
    > from elementtree.ElementTree import Element, SubElement, tostring



    Just to be clear: that's the effbot's ElementTree package at
    http://effbot.org/zone/element-index.htm

    --
    Mike
    Mike Thompson, Dec 16, 2004
    #2
    1. Advertising

  3. Without further checking I would propose you let WingIDE ignore this
    exception - most probably WingIDE is choking on a exception that was
    thrown intentionally by the module writer.

    I hope you know how to let WingIDE ignore exceptions? (In the upper part
    of the Exceptions-tool click on 'Ignore this exception location')... hope
    this helps.

    Regards,
    Marco
    Marco Aschwanden, Dec 16, 2004
    #3
  4. Marco Aschwanden wrote:
    > Without further checking I would propose you let WingIDE ignore this
    > exception - most probably WingIDE is choking on a exception that was
    > thrown intentionally by the module writer.
    >
    > I hope you know how to let WingIDE ignore exceptions? (In the upper
    > part of the Exceptions-tool click on 'Ignore this exception
    > location')... hope this helps.
    >


    Goan. It does help, thanks Marco. I was working with totally the wrong
    paradigm. I was assuming the reported exception was uncaught (that's how
    Komodo works) ... it was a very confusing place to be late at night -
    WingIDE bug seemed the only explanation, although it was puzzling me
    that something so obvious could make it through their QA. Thanks again.

    --
    Mike
    Mike Thompson, Dec 16, 2004
    #4
  5. Mike Thompson

    David Bolen Guest

    Mike Thompson <none.by.e-mail> writes:

    (...)
    > WingIDE bug seemed the only explanation, although it was puzzling me
    > that something so obvious could make it through their QA. Thanks again.


    I haven't used ElementTree, but if it includes an extension module
    (likely for performance), it's important to realize that WingIDE's
    debugger specifically catches exceptions that occur on the "far" side
    of an extension module. So even if that extension module would
    normally suppress the exception, thus hiding it from the original
    Python code that called the extension module, Wing's debugger will
    stop at it, which is different than normal runtime.

    This can actually be very helpful, since for example, debuggers that
    can't do this can't stop on exceptions in cases such as wxPython event
    handlers, since they occur from within a C extension too.

    Wing has a bunch of default locations that it ignores (that would
    otherwise trigger via normal standard library calls), but for your own
    applications or libraries, you need to teach it a bit, by asking it to
    ignore locations you know not to be relevent to your code. Once you
    mark such a location, it is remembered in your project so it won't
    bother you again.

    This was discussed a bit more in depth recently in the "False
    Exceptions" thread on this group. See:

    http://groups-beta.google.com/group..._frm/thread/f996d6554334e350/e581bea434d3d248

    -- David
    David Bolen, Dec 17, 2004
    #5
  6. Mike Thompson wrote:

    > File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line 709, in _write
    > for n in node:
    > File "C:\Python23\Lib\site-packages\elementtree\ElementTree.py", line 227, in __getitem__
    > return self._children[index]
    >
    > The exception is triggered in ElementTree but the code is fine. Something about the Wing IDE
    > debuger is causing this exception to be thrown.


    note that the code is using a for-loop to process all items in a container object. the
    IndexError is supposed to tell the for-loop to stop; having a Python IDE report this
    as an error is remarkably brain-dead...

    (do they stop on StopIteration exceptions too? or IOError exceptions from open?)

    </F>
    Fredrik Lundh, Dec 17, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    915
    Axel Straschil
    Apr 6, 2005
  2. gregarican

    IDE Suggestions

    gregarican, Aug 2, 2007, in forum: Java
    Replies:
    20
    Views:
    738
    John mitre
    Aug 3, 2007
  3. Daniel Pitts
    Replies:
    7
    Views:
    431
    Erik Wikström
    Apr 1, 2008
  4. Barrie Jarman

    IDE suggestions

    Barrie Jarman, Mar 3, 2006, in forum: Ruby
    Replies:
    15
    Views:
    164
    Mike Austin
    Mar 21, 2006
  5. Replies:
    2
    Views:
    91
Loading...

Share This Page