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


Groups > comp.lang.python > #106953

Re: IdentationError; unexpected indent

From alister <alister.ware@ntlworld.com>
Subject Re: IdentationError; unexpected indent
Newsgroups comp.lang.python
Message-ID <t6uPy.838727$hz.420469@fx42.am4> (permalink)
Organization virginmedia.com
Date 2016-04-13 16:04 +0000

Show all headers | View raw


On Wed, 13 Apr 2016 16:53:09 +0100, 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()*
> 
> 
> Thank you in advance.

correct the indentation for the line that is listed in the traceback
(this may possibly be due to mixing tabs and spaces)

for more detailed help please post a usable copy of the code (without the 
leading & trailing '8' characters on each line) and a full copy of the 
traceback






-- 
I brought my BOWLING BALL -- and some DRUGS!!

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


Thread

Re: IdentationError; unexpected indent alister <alister.ware@ntlworld.com> - 2016-04-13 16:04 +0000

csiph-web