Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Index Error (http://www.velocityreviews.com/forums/t954669-re-index-error.html)

Chris Angelico 11-20-2012 01:48 PM

Re: Index Error
 
On Wed, Nov 21, 2012 at 12:43 AM, inshu chauhan <insideshoes@gmail.com> 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


All times are GMT. The time now is 01:30 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.