Problems with the Python indentation in Geany

0

Since I changed IDE (I moved from Pycharm to Geany), I started to have many problems with the error: "inconsistent use of tabs and spaces in indentation".

I would like to know a way to solve this constant problem, use only tab for indentation, no spaces or anything else.

    
asked by anonymous 25.09.2017 / 21:03

3 answers

2

Geany uses tab by default in indentation.

Change in Edit > Preferences > Editor > Indentation of Tabs for Spaces.

Python uses, by convention, 4 spaces to indentify (Pycharm pattern), and should not be mixed tab and space to avoid compilation error.

    
25.09.2017 / 21:16
1

Generally, Python presents these errors because the compiler relies heavily on indentation. It is recommended not to use too much copy and paste taking code from other corners or sites because when you do this they can come with different spacing when you insert into the IDE of your preference.

You can also use Sublime Text as a different way to do your code because it is a good editor for this kind of thing. I also changed Pycharm and I currently use Sublime to program in Python because it has a good indentation.

    
25.09.2017 / 21:18
0

Looking at the code you've posted in an editor that lets you view tabs and spaces so they are not invisible (Notepad ++):

The rest of the file is indented with spaces. I recommend to always indent with spaces, which give less pain to the head.

    
25.09.2017 / 22:32