Benyamin Noori
Benyamin Noori

Reputation: 880

Error While Running python manage.py shell

I'm following the documentation of Django, and I've encountered a problem running this command: python manage.py shell

This is the error I get:

File "manage.py", line 7
  from django.core.management import execute_from_command_line

TabError: inconsistent use of tabs and space in indentation

I realize what it means, but I don't know how to edit my manage.py file so it works. I might have accidentally edited the indentations and now I don't know how to revert.

This is what my manage.py file currently looks like:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "polling.settings")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

Thanks!

Upvotes: 2

Views: 1463

Answers (2)

marven
marven

Reputation: 1846

You're using a mix of tabs and spaces as indentions in your manage.py file. Use a text editor such as SublimeText that displays the whitespaces as spaces/tabs so you can easily change them.

See http://legacy.python.org/dev/peps/pep-0008/#tabs-or-spaces for more info.

Upvotes: 4

Alexander Ejbekov
Alexander Ejbekov

Reputation: 5960

Look carefully through manage.py. Line 7 in particular. You are using both tabs and spaces as indentation.

Upvotes: 0

Related Questions