Winge IDE Issue - an suggestions?

M

Mike Thompson

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
 
M

Marco Aschwanden

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
 
M

Mike Thompson

Marco said:
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.
 
D

David Bolen

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
 
F

Fredrik Lundh

Mike said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top