Sunday, August 21, 2016

Python - Inconsistent use of tabs and spaces in indentation - Notepad++

Filled under:

I am trying to making Python 3.4 application using Notepad++ and windows command prompt.
I want to make main() function code block and call it in the __name__.
The line is looking like bellow:
#!\Python34\python
import os;

def main():
 bahasa = ['Python','Perl'];
 for b in bahasa:
  print(b);
 os.system("pause");

if __name__ == "__main__":
 main();
I saved syntax above in D:\PythonProject and named hello.py when I run the script using windows command prompt by typing
D:\PythonProject>python hello.py
I get error warning : TabError: inconsistent use of tabs and spaces in indentation I set Notepad++ tabs configuration by going to Setting --> Preference --> Language Menu then I choose Python, and I go to Tab Settings then I choose Python. It will automatically change the setting of our text editor from tabs into tab-space. It runs successfully.

Posted By Novida7:48 PM