Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Re: Error

 
 
Mark Lawrence
Guest
Posts: n/a
 
      11-20-2012
On 20/11/2012 12:31, inshu chauhan wrote:
> I did the following changes in this part of my programme.. now the
> refereence error is removed but its showing me another error :
>
> def ComputeClasses(data):
> radius = .5
> points = []
> for cy in xrange(0, data.height):
> for cx in xrange(0, data.width):
>
> if data[cy,cx] == (0.0,0.0,0.0):
> continue
> else :
> centre = data[cy, cx]
> print centre
> points.append(centre)
>
>
> change = True
>
> while change:
>
> for ring_number in xrange(1, 1000):
> change = False
> new_indices = GenerateRing(cx, cy, ring_number)
>
> for idx in new_indices:
> point = data[idx[0], idx[1]]
>
> if point == (0.0, 0.0, 0.0 ):
> continue
> else:
>
> dist = distance(centre, point)
> if dist < radius :
> print point
> points.append(point)
> change = True
> print change
>
>
> break
>
>
> print points
>
>
> ERROR :
>
> Traceback (most recent call last):
> File "Z:/modules/classification1.py", line 71, in <module>
> ComputeClasses(data)
> File "Z:/modules/classification1.py", line 47, in ComputeClasses
> point = data[idx[0], idx[1]]
> error: index is out of range
>
> What is meant by this statement ' Index out of range ' ? Does it mean that
> my range 1, 1000 is exceeded ??
>
>


What makes you think the error applies to the value from the xrange
call? The traceback tells you that the error has occurred at line 47.
Looking at that and the lines above, I'd guess your problem lies in the
return values from the GenerateRing function.

--
Cheers.

Mark Lawrence.

 
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
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments