Reputation: 3920
while i trying to execute following code
for value in jsondata:
command = value['command']
val = value['value']
print command
print val
if command=='sel_media':
t = find(dirpath + '\\' + myarg)
t1= capture(t.getX() - 50, t.getY() + 50, t.getW(), t.getH())
click(t1)
else:
print "else inside-----------"
am getting
else:
^
indentationError: unindent does not match any outer indentation level
i dont know why it is happening? please correct me
Upvotes: 0
Views: 71
Reputation: 991
Set your code editor to use spaces instead of tabs and set those tabstops to 4. Python uses 4 spaces to differentiate between code blocks. Also you can try using sublime, it does this autoatically according to file types. You can also try to manually put 4 spaces and then wrtiting your code accordingly. Hope it helps.
Upvotes: 0
Reputation: 9354
This is probably due having a tab in your code somewhere. Python treating tabs as 8 spaces, but your editor is probably set up to display them as 4 spaces. try using python -t
which will give you an error if you use a tab character.
Upvotes: 0
Reputation: 21241
Please check all blank
s in your file ans spaces not tab
. If you have vim
editor you can check by :set list
command.
Upvotes: 0
Reputation: 114461
Your code is probably mixing tabs and spaces for indentation.
Just set your editor to never use tabs. All decent programming editors have this option.
Upvotes: 2