Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Winge IDE Issue - an suggestions?

Reply
Thread Tools

Winge IDE Issue - an suggestions?

 
 
Mike Thompson
Guest
Posts: n/a
 
      12-16-2004

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





 
Reply With Quote
 
 
 
 
Mike Thompson
Guest
Posts: n/a
 
      12-16-2004
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
 
Reply With Quote
 
 
 
 
Marco Aschwanden
Guest
Posts: n/a
 
      12-16-2004
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

 
Reply With Quote
 
Mike Thompson
Guest
Posts: n/a
 
      12-16-2004
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
 
Reply With Quote
 
David Bolen
Guest
Posts: n/a
 
      12-17-2004
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/...81bea434d3d248

-- David
 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-17-2004
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>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IDE/SATA and IDE/ATA controller mdnchauhan Software 0 05-19-2008 05:30 AM
[IDE] - The Dynamic Opportunity - ActiveState Komodo IDE / Open Source Ilias Lazaridis Python 6 01-28-2006 09:42 PM
[IDE] - need a simple IDE which lists methods and variables Ilias Lazaridis Ruby 13 04-12-2005 01:35 AM
Python IDE like NetBeans/Delphi IDE fowlertrainer@anonym.hu Python 5 04-06-2005 05:56 AM
enhanced ide vs ide AndyPaul Computer Information 1 01-01-2004 03:30 AM



Advertisments