View previous topic :: View next topic |
Author |
Message |
turtles Veteran
Joined: 31 Dec 2004 Posts: 1655
|
Posted: Sat Nov 10, 2018 1:23 am Post subject: Editing python 2 files in Kate |
|
|
Greetings all amateur hour question here for all you Python fans.
Every time I edit a python 2 file I seem to eventually mess it up due to white space and get Code: | IndentationError: unexpected indent |
Is there a slick way the Kate text editor can auto detect what the tab / whitespace indent char is in a file?
AS I am not the original author of these it is quite challenging to decipher what the little >> chars mean in Kate, then dig around in the Kate settings and set the tab = 8 spaces type thing.
I realize Python 2 expects 8 spaces per indent or one tab char, and python 3 needs a different setting just not sure how to optimize Kate for that?
Thanks in advance. _________________ Donate to Gentoo |
|
Back to top |
|
|
Tatsh Apprentice
Joined: 22 Jul 2007 Posts: 187
|
Posted: Wed Dec 05, 2018 9:31 am Post subject: Re: Editing python 2 files in Kate |
|
|
turtles wrote: | Greetings all amateur hour question here for all you Python fans.
Every time I edit a python 2 file I seem to eventually mess it up due to white space and get Code: | IndentationError: unexpected indent |
|
I'm assuming this is in the stdout and it probably can be ignored.
Quote: | Is there a slick way the Kate text editor can auto detect what the tab / whitespace indent char is in a file? |
Kate does this as soon as you load the file, but with spaces it's not a guarantee. If it guesses wrong you need to set the value at the bottom right or . Most projects use Soft Tabs: 4, spaces only (this is also part of the PEP8 standard).
Quote: | AS I am not the original author of these it is quite challenging to decipher what the little >> chars mean in Kate, then dig around in the Kate settings and set the tab = 8 spaces type thing. |
I use Kate often and I'm not sure what you are referring to here. Are you sure your configuration is sane? You can reset the settings by deleting ~/.config/kate*rc
In Python, >> means bitwise shift right.
If you're looking at a bad Git merge, >>>>>>>>> marks where the unmergeable lines are.
Quote: | I realize Python 2 expects 8 spaces per indent or one tab char, and python 3 needs a different setting just not sure how to optimize Kate for that? |
Both versions of Python expect consistent indents (could be any amount or tabs) not an exact number of spaces. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|