mardi 17 février 2015

Python unindent error only in python REPL even with correct # of spaces (and no tabs)


Vote count:

0




In the following code block



def classify0(inx, ds, ls, k):
sdindices = dist.argsort()
clcount = {}
for i in range(k):
somecode = 'blah'
sclcount = sorted(clcount.iteritems(), key=operator.itemgetter(1), reverse=True)
# Previous lines gives: IndentationError: unindent does not match any outer indentation level
return sclcount[0][0]


As shown in the comment, the line starting with



sclcount = "


gives the indention error. Now I have checked all the 'usual suspects': there are no tabs and the correct # of spaces.


Also, i am using PyCharm (/intellij) and no warnings/syntax errors . Only in the python shell..



asked 38 secs ago

javadba

3,707






Python unindent error only in python REPL even with correct # of spaces (and no tabs)

Aucun commentaire:

Enregistrer un commentaire