Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixing indentation issues.
#1
Hi there.

I know this is an editor problem, not Python itself, but it's driving me nuts, it have have cropped up with other people and I'm interested in what they did.

I have built up a pretty big collection of python scripts now and I have a need to edit them in different locations. The code is centralised, but I maybe on a windows machine one day, a MacBook the then, or vnc'd to a unix box. I always prefer a decent editor with some intellisense, so where possible I use VS Code, if that's not available I'll use nano.

However, after making changes and saving scripts they may then not open correctly in other apps, indentation is messed up. It may be one line which I can delete back and put back in place, it may be some invisible character that I have to chase all the way up or down my code, or it may be a stupid indentation that I just cannot fix, usually a double indentation after a def that isn't correct, but the code won't run without it.

To compound the problem if I go back to the previous editor to see what's gone wrong the code is either worse or will give random incorrect runtime errors. Of course to the compiler the errors are valid, but they're not to the eye.

The problem is this makes bug fixing a complete nightmare. Imagine trying to fix a variable that isn't getting set in a 300 line script where the indentation is all incorrect.

I have in the past had to completely re-write scripts identically to the eye to get them working again. This is a ball ache.

I do realise with Python and it's fairly loose structure, no end if, no end sub, no end function, it' damn difficult to fix indentation errors if you're not intimate with the code. I WISH there was an option to force strict ends. But, is there an app out there anywhere that can fix these odd problems? It must be a character out of place, a tab that can't be seen, a space, some other cr/lf issue.

I know the bet practice would be - Only use one editor in one location, but this just isn't possible. And in this day and age it should be possible to hand your code to someone else and receive back changes without this crap.

Any other suggestions?

Many thanks.
Reply


Messages In This Thread
Fixing indentation issues. - by MuntyScruntfundle - Jan-31-2019, 04:50 PM
RE: Fixing indentation issues. - by ichabod801 - Jan-31-2019, 05:04 PM
RE: Fixing indentation issues. - by Larz60+ - Jan-31-2019, 05:40 PM
RE: Fixing indentation issues. - by wavic - Feb-02-2019, 01:19 PM
RE: Fixing indentation issues. - by metulburr - Feb-02-2019, 01:21 PM
RE: Fixing indentation issues. - by wavic - Feb-02-2019, 01:36 PM
RE: Fixing indentation issues. - by ichabod801 - Feb-02-2019, 04:20 PM
RE: Fixing indentation issues. - by snippsat - Feb-02-2019, 05:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  (python) Can i get some help fixing a English to Morse translator? Pls AlexPython 7 1,643 Sep-12-2022, 02:55 AM
Last Post: AlexPython
  Invalid syntax error - need help fixing calgk01 3 3,330 Feb-23-2021, 08:41 PM
Last Post: nilamo
  Fixing a code error Twoshawns 5 2,801 May-14-2020, 11:56 AM
Last Post: Twoshawns
  Help Fixing Code kianwalters05 5 3,996 May-12-2020, 12:13 PM
Last Post: kianwalters05
  Fixing "PermissionError: [Errno 13] Permission denied" puredata 17 72,811 Mar-09-2020, 03:20 PM
Last Post: syssy
  Fixing the code khanhcao 2 91,638 Feb-06-2020, 07:24 AM
Last Post: buran
  Fixing a problem with file.io ThickTac 2 2,654 Mar-13-2019, 10:13 PM
Last Post: ThickTac

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020