Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

"unindent does not match ..." error

so i started coding in python inside sage. yay.

this is my code that bombs:

def cable_from_pc_list(pc_list):
 xo, xd, zo, zd = var('xo xd zo zd')
 o, d = var('o d')
 o = vector([xo, zo])
 d = vector([xd, zd])

for i in pc_list:
    o = i['origin']
    d = i['dest']
    q = i['charge']
    s1 = o - d
    s2 = -s1/abs(s1) * (R^2/abs(s1))
    show(d + s2)

and surprisingly it throws this error:

sage: load('/home/andreas/src/dissertation/analytical/demo.sage')
  File "<string>", line 8
    for i in pc_list:
                     ^
IndentationError: unindent does not match any outer indentation level

This is in a single file, the only code, in a fresh sage process. There are no tabs in that file, and the indention is consistent (4 spaces).

i googled for python help and found out about the "set up your environment and editor correctly", which i made sure of.
Please help me fix this.

"unindent does not match ..." error

so i started coding in python inside sage. yay.

this is my code that bombs:

def cable_from_pc_list(pc_list):
 xo, xd, zo, zd = var('xo xd zo zd')
 o, d = var('o d')
 o = vector([xo, zo])
 d = vector([xd, zd])

for i in pc_list:
    o = i['origin']
    d = i['dest']
    q = i['charge']
    s1 = o - d
    s2 = -s1/abs(s1) * (R^2/abs(s1))
    show(d + s2)

and surprisingly it throws this error:

sage: load('/home/andreas/src/dissertation/analytical/demo.sage')
  File "<string>", line 8
    for i in pc_list:
                     ^
IndentationError: unindent does not match any outer indentation level

This is in a single file, the only code, in a fresh sage process. There are no tabs in that file, and the indention is consistent (4 spaces).

i googled for python help and found out about the "set up your environment and editor correctly", which i made sure of.
I use emacs and with help of whitespace-mode i made sure of the indention and tab-freeness. Please help me fix this. this.