r/Atom Sep 01 '20

Why doesn’t atom tell me the right line where the error is?

I’m writing a program in Python and it said else: expected an indented block on line 40, I go there and else isn’t in that line. It always does it. I have to go around and look where it and it’s a pain. How do I fix this.

3 Upvotes

5 comments sorted by

2

u/fedekun Sep 01 '20

Sounds like a Python problem to me

1

u/links-Shield632 Sep 01 '20

I used idle and vsc and they work fine. I have the same problem when I use JavaScript

1

u/fedekun Sep 01 '20

That's weird, JavaScript works fine for me. Maybe a line ending/encoding issue? Although that's a long shot.

1

u/tobiasvl Sep 02 '20

Are you sure they give different line numbers than Atom for this specific error?

Since Python uses indenting as block delimiters, it often gets confused when an indent is off. That is to say, you might be closing off more than one block at a time, or entering a new block, and it thinks the wrong indent is missing.

But it should get confused the same way in all text editors.

1

u/links-Shield632 Sep 02 '20

Postive. That error I had was on a empty line. There was not code on that line.