Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33339

Error

Path csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <insideshoes@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'subject:Error': 0.07; 'received:mail-qc0-f174.google.com': 0.09; 'referenced': 0.09; 'def': 0.10; '0.0,': 0.16; '1000):': 0.16; 'dist': 0.16; 'idx': 0.16; '&lt;': 0.17; 'skip:\xa0 30': 0.17; 'variable': 0.20; 'skip:" 30': 0.20; 'to:name:python- list@python.org': 0.20; 'assignment': 0.22; 'to:2**1': 0.23; '(most': 0.27; 'message-id:@mail.gmail.com': 0.27; 'points': 0.29; 'skip:& 10': 0.29; 'error': 0.30; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'print': 0.32; 'getting': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'false': 0.35; 'continue': 0.35; 'received:209.85': 0.35; 'skip:p 20': 0.36; 'unable': 0.36; 'why': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'skip:u 10': 0.60; '8bit%:100': 0.70; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.84; '74,': 0.91; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=JY8AWxItjtzNmsa73qznr/5We0r9NWUgqhWmwob+q3Y=; b=OjIB7IzqlwZj8gpllLTWFJEd1fCn3RBXBWcdWcHXksfS93EwuhmwIgZ9D4AVzfX/Rn 2ewnGNpfPl2d5fmySeniLQQ6UBYeZUBJ+dMDDk0EAYn9dvJAndbVaQPsDpDGNgHKntrE ZawLMlcYytPJTubU5UBqh8qQnU0L31oLeBB4Pwp9Cit6NHGRxNVdk4msDs4rd1yjGXGJ 0mpHQVFkdmVvoRIXX8JGcC9W7jBkXcHvFur2Zlmc+bN5EzkfsWGC8DHUp9bkCCXqKHD3 mWNWEhkh0ek/qjhSmQfZEW6rLgBM04FPuHdljOdvBmmNx36bvdKyxaJQiEYPNzUND5MJ 6ixw==
MIME-Version 1.0
Date Wed, 14 Nov 2012 16:18:38 +0100
Subject Error
From inshu chauhan <insideshoes@gmail.com>
To "python-list@python.org" <python-list@python.org>, Zero Piraeus <schesis@gmail.com>
Content-Type multipart/alternative; boundary=047d7bdc101089634a04ce760cff
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3685.1352906321.27098.python-list@python.org> (permalink)
Lines 87
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352906321 news.xs4all.nl 6915 [2001:888:2000:d::a6]:37778
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33339

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

for this code m getting this error :

CODE :
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):
                centre = data[cy, cx]
                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


ERROR :
Traceback (most recent call last):
  File "Z:\modules\classification2.py", line 74, in <module>
    ComputeClasses(data)
  File "Z:\modules\classification2.py", line 56, in ComputeClasses
    dist = distance(centre, point)
UnboundLocalError: local variable 'centre' referenced before assignment

And i am unable to understand .. WHY ?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Error inshu chauhan <insideshoes@gmail.com> - 2012-11-14 16:18 +0100

csiph-web