LilReef599
LilReef599

Reputation: 31

How do I remove this red error text produced by Pylint?

Example I don't know why this is happening all of a sudden, before it only showed the red underline and I had to put my mouse over it to see the error message which is what I prefer. I tried my best to look this problem up but don't know how to describe this.

How to remove the text itself, and show only the highlight? Thanks in advance!

Solution: I was able to figure it out, it was an extension (one dark pro) I was using within VS code that creates the red error text. I thought it was a problem with pylint. Sorry about that and thanks for your guys help!

Upvotes: 1

Views: 558

Answers (1)

CryptoFool
CryptoFool

Reputation: 23079

The example you show contains a syntax error in both Python 2 and Python 3. If something changed to cause this to be called out quite clearly, then that's a good thing, as this text won't run regardless of if your editor says that or not.

Why would you want to change the behavior in this case? The answer here is clearly to add a : to your code. If you get text you don't wish to have on your screen for problems that are not clear syntax errors, then I would suggest that you post an example of one of those...that is, post an example of something where it makes sense to soften the behavior of the syntax highlighter.

Again, to fix the problem with both the code and the highlighting, add a colon to the end of the first line, ie:

if __name__ == "__main__":
    print("Hello")

As an aside...I would suggest that you use parentheses with all of your print statements even if you are currently using Python 2.X. This will allow your print statements to work without modification if/when you switch to Python 3 (mentioned this only because difference between print in Python 2.X vs 3.X came up in the comments and other answer.)

Upvotes: 1

Related Questions