DO NOT DEAL WITH THIS MEMBER
Greetings,
I was curious if you guys had any tips about a Sublime setup when it comes to Python? Sometimes when I go run my code I get an unexpected indent error. It happens ... so I go check statements, tabs, and spaces.
The issue is when I 'fix' one line of code, the spaces or whatever, it affects the next line. I fix that next line, and it happens to the next line! It is quite frustrating. It doesn't matter if I start corrections from the top or below. I can select the text and see the spaces and tabs. They change as I make the corrections to other lines.
No tips about Sublime setup, but launching the script by:
Code python -tt script.py
should solve the problem.
Are you mixing tabs and spaces? Python can generally handle either, but not both.
Hi, i had this problem also, but i found the easiest trick for it.
In Sublime click, View->Indentation->Convert indentations to Tabs
DO NOT DEAL WITH THIS MEMBER
(Oct 25, 2016 10:05 PM)SpacePupper Wrote: Are you mixing tabs and spaces? Python can generally handle either, but not both.
Not directly. I strictly use tabs, but somehow spaces get in there.
(Oct 26, 2016 04:59 AM)bytez Wrote: Hi, i had this problem also, but i found the easiest trick for it.
In Sublime click, View->Indentation->Convert indentations to Tabs
Thanks. I think that'll help a bit. But I think it maybe more that my tab size was 4. I have to manually restructure about 10 scripts and thousands of lines of code just to fix the spacing. Find a replace doesn't fully do the job.
(Oct 26, 2016 11:34 AM)datguy.dev Wrote: Not directly. I strictly use tabs, but somehow spaces get in there.
Thanks. I think that'll help a bit. But I think it maybe more that my tab size was 4. I have to manually restructure about 10 scripts and thousands of lines of code just to fix the spacing. Find a replace doesn't fully do the job.
I had the problem cause i copy pasted my script from pycharm, and the fix works all the time, it converts every line so i dont have to do it manually :)
How come you have to do manually when it does it auto? :D
DO NOT DEAL WITH THIS MEMBER
(Oct 26, 2016 01:18 PM)bytez Wrote: I had the problem cause i copy pasted my script from pycharm, and the fix works all the time, it converts every line so i dont have to do it manually :)
How come you have to do manually when it does it auto? :D
The automatic indentation function you stated previously isn't correctly fixing all the indents. It'll randomly leave 4 spaces, in other areas in doesn't. It breaks statements, nested statements, and thus the flow of a script. So I have to do a logic check as well. meh. . . It is better than nothing.
(Oct 26, 2016 01:29 PM)datguy.dev Wrote: The automatic indentation function you stated previously isn't correctly fixing all the indents. It'll randomly leave 4 spaces, in other areas in doesn't. It breaks statements, nested statements, and thus the flow of a script. So I have to do a logic check as well. meh. . . It is better than nothing.
Oh wierd, it works alright for me, but i dont have like 500 lines programs :D
DO NOT DEAL WITH THIS MEMBER
(Oct 26, 2016 02:07 PM)bytez Wrote: Oh wierd, it works alright for me, but i dont have like 500 lines programs :D
Honestly, it is just messing up because of the current spacing issues in scripts. This is a good learning experience for me to setup before starting. Thanks for the suggestion. It saved me quite some time. 👍
|