Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Joel Goldstick Newsgroups: comp.lang.python Subject: Re: IdentationError; unexpected indent Date: Thu, 14 Apr 2016 09:07:14 -0400 Lines: 111 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de KrI4GOUr3w95dJ8pedAIMg4L5SNiKiakn+BsqU6A/gWQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'sys': 0.05; 'f.close()': 0.07; 'cc:addr:python-list': 0.09; '"r")': 0.09; 'editor.': 0.09; 'loop.': 0.09; 'statements': 0.09; 'unexpected': 0.09; 'received:209.85.218': 0.10; 'url:blog': 0.10; 'python': 0.10; 'wed,': 0.15; 'thu,': 0.15; "'*'": 0.16; '17:02': 0.16; '2016': 0.16; 'dist': 0.16; 'exactly?': 0.16; 'f.read()': 0.16; 'igor': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'tabs': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(see': 0.20; 'please?': 0.22; 'skip:* 50': 0.22; 'am,': 0.23; 'appears': 0.23; 'code,': 0.23; 'advance.': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'error': 0.27; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'executing': 0.27; 'correct': 0.28; 'skip:( 20': 0.28; '13,': 0.29; 'symbols': 0.29; 'code:': 0.29; 'print': 0.30; 'url:mailman': 0.30; 'code': 0.30; "i'd": 0.31; 'run': 0.33; 'url:python': 0.33; 'closely': 0.33; 'url:listinfo': 0.34; 'skip:d 20': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'displays': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'skip:s 50': 0.37; 'received:209': 0.38; 'skip:p 20': 0.38; 'thank': 0.38; 'hi,': 0.38; 'why': 0.39; 'url:mail': 0.40; 'your': 0.60; 'you.': 0.64; 'response.': 0.66; 'fact,': 0.67; 'url:info': 0.71; '2.7.': 0.84; 'edge,': 0.84; 'to:none': 0.91; '*for': 0.91; 'joel': 0.91; 'subject:; ': 0.91; 'you...': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=Hd5NVRUMv4HwLb3wqr6ziWsc/+BM/IQC+bn4/gfwuTw=; b=C+i5eReo5mJJWLUiMG43O7ln6UBTsrC2oRZfXvtsSPF3rXIaNtPQSMyogX4fZGqwcR PqV5453g5Vnii1+CiWoidcrycS5MfoX8XVAeTsuvZBOnj0+U+7622uce81jOfnhPBzh3 vPg7BO/ak8bcwiQ/DCqhm4R1OdXI2syAWwRoHYhgySjtJNsJuYPDYTGY+SxK54ojxnRL kIhOkp0224Nyj5Vwjyvy3IAE0Ih2zHbiD8Omd5h/+I2yoi4gLtFU9sEsEB/EWQxJy4NH TSDUCPDcTdlD0sjFFPhmj4/WCLRlapZkiOwUJRA6DSm4+cqNWlQPXVgdj+IwslA/x7HY stlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=Hd5NVRUMv4HwLb3wqr6ziWsc/+BM/IQC+bn4/gfwuTw=; b=XlW2p+Vak2HX92UGHXoaJZFTSIOYCBlPjnbfHKY4GEh/YnKchrl1V/qIvm1OhOjSIT tH9n0qQFyNKlGC2ORRF2ubMHiiKrjUoV5D8ckGr+rjYpmFZHmjeWjiCb3uI4+aRYU29v QCGE9drjGmVKCOP1/1uUJNVxn7bwqjw8pBofSCpUM2Wk2MzfNqnlemg5ak85pd3UqAhi aqqQCdsXnRwRYi0WIQ0srWsmrgfsqtaabVyPHCJAfcueo02tvM67pM9dIq+VGSpVrMVY ZvNlKbEZ05UoFsYyC8DYzQEGE4jLyaSosucvaWiIMN+c16lfTHbkhalL02WBup/dnG6N 6b3Q== X-Gm-Message-State: AOPr4FUojDJ7MWGVQ1zA+jCUPsr3wgpAy6tGU2QrcnV4TN4FY2hRvk0SMPYTb5DTxTtJM3DeWP12P/v3vAjvEg== X-Received: by 10.202.204.130 with SMTP id c124mr7360155oig.112.1460639234705; Thu, 14 Apr 2016 06:07:14 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:106998 On Thu, Apr 14, 2016 at 8:04 AM, Igor Korot wrote: > Salma, > > On Thu, Apr 14, 2016 at 3:28 AM, salma ammar wrote: >> Hi Igor, >> >> thank you very much for your response. In fact, I put the code in bold, that >> is why it displays those symbols. >> This is the code: >> >> import sys >> sys.path.append('C:/Users/user/src/sumo-0.22.0/tools') >> import sumolib >> net = >> sumolib.net.readNet("C:/Users/user/src/sumo-0.22.0/tools/sumolib/net/qgislyonvelo.net.xml") >> radius = 0 >> f = open("C:/fichierstationsvelos.txt", "r") >> contenu = f.read() >> print(contenu) look closely at this for loop. Print and edges don't line up with the other statements >> for id, lat, lon in f: >> x, y = net.convertLonLat2XY(lon, lat) >> print(x, y) >> edges = net.getNeighboringEdges(x, y, radius) >> print (edges) >> while len(edges) == 0: >> radius = radius + 10 >> edges = net.getNeighboringEdges(x, y, radius) >> distancesAndEdges = sorted([(dist, edge) for edge, dist in edges]) >> print(distancesAndEdges) >> edgeofstation[id] = distancesAndEdges[0] >> print (edgeofstation[id]) >> f.close() > > And what is the error message exactly? Can you copy/paste it as well? > > Also, I'd advise you to subscribe to the list so that other people can > help you... > > Thank you. > >> >> >> Cordially. >> >> 2016-04-13 17:02 GMT+01:00 Igor Korot : >>> >>> Hi, Salma, >>> >>> On Wed, Apr 13, 2016 at 11:53 AM, salma ammar >>> wrote: >>> > Hi, >>> > >>> > I am about to run this code using python 2.7. But when executing this >>> > code, >>> > an error appears (see attachement): IdentationError; unexpected indent >>> > >>> > What should I rectify to correct this error please? >>> > >>> > >>> > *import sys* >>> > *sys.path.append('C:/Users/user/src/sumo-0.22.0/tools')* >>> > *import sumolib* >>> > *net = >>> > >>> > sumolib.net.readNet("C:/Users/user/src/sumo-0.22.0/tools/sumolib/net/qgislyonvelo.net.xml")* >>> > *radius = 0* >>> > *f = open("C:/fichierstations.txt", "r")* >>> > >>> > *contenu = f.read()* >>> > >>> > *print(contenu)* >>> > *for id, lat, lon in f:* >>> > * x, y = net.convertLonLat2XY(lon, lat)* >>> > * print(x, y)* >>> > * edges = net.getNeighboringEdges(x, y, radius)* >>> > * print (edges)* >>> > * while len(edges) == 0:* >>> > * radius = radius + 10* >>> > * edges = net.getNeighboringEdges(x, y, radius)* >>> > * distancesAndEdges = sorted([(dist, edge) for edge, dist in edges])* >>> > * print(distancesAndEdges)* >>> > * edgeofstation[id] = distancesAndEdges[0]* >>> > * print (edgeofstation[id])* >>> > *f.close()* >>> >>> What are those '*' symbols in the e-mails? >>> Are they hard tabs or something else? >>> >>> Please copy and paste the script from the editor. >>> >>> Thank you. >>> >>> > >>> > >>> > Thank you in advance. >>> > -- >>> > https://mail.python.org/mailman/listinfo/python-list >> >> > -- > https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays