Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Index Error

Reply
Thread Tools

Re: Index Error

 
 
Chris Angelico
Guest
Posts: n/a
 
      11-20-2012
On Wed, Nov 21, 2012 at 12:43 AM, inshu chauhan <(E-Mail Removed)> wrote:
> I need help in this part as I am unable to device a method in which if the
> points are out of index,it should stop.....
>
> Traceback (most recent call last):
> File "Z:/modules/Classify.py", line 73, in <module>
> ComputeClasses(data)
> File "Z:/modules/Classify.py", line 49, in ComputeClasses
> point = data[idx[0], idx[1]]
> error: index is out of range
>


When Python throws an exception, you can catch it and handle it as you
please. In this instance, it seems to me you want to break out of one
loop (if I've read your comments correctly), so just bracket that loop
with try... except. Start here:

http://docs.python.org/3.3/tutorial/errors.html

ChrisA
 
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
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" camelean@shaw.ca ASP .Net 3 02-22-2011 07:06 PM
Program Index: cannot view entire index XP Luke O'Malley Computer Support 2 05-05-2008 03:34 AM
sorting index-15, index-9, index-110 "the human way"? Tomasz Chmielewski Perl Misc 4 03-04-2008 05:01 PM
index.htm or index.html ? Robert Cooze NZ Computing 15 12-13-2005 05:53 PM
problem with index.html .(page is automatically gettin redirected to index.html) karthikeyavenkat Java 2 03-17-2005 10:01 PM



Advertisments