0

Possible Duplicate:
IndentationError: unindent does not match any outer indentation level

i wrote the following python code but i can't see what is the cause of the problem but i get the following error message:

def post(self): ^ IndentationError: unindent does not match any outer indentation level

class MainHandler(webapp2.RequestHandler):
def get(self):
    self.response.out.write(form)

def post(self):
    self.response.out.write("valid")

app = webapp2.WSGIApplication([('/', MainHandler)],debug=True)

any help will be appreciated

Community
  • 1
  • 1

2 Answers2

2

Your code example is riddled with TAB characters. If you are mixing tabs with spaces, the error is almost a given.

Use the python tabnanny to clean up your source-code, switch your editor to use spaces only, then fix your indentations:

python -m tabnanny -v path/to/your/code.py
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
0

You've mixed up spaces and tabs. Run the script in python -tt to verify.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358