Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

562
Visualizações
VS Code shows an error message at print statement in python 2.7

I use VS Code Version 1.19.3 with Python 2.7 on Windows.

Recently pylint (code analyzer) shown an error message "E1601:print statement used"

But I don't know why! Can someone help me?

The print statement is correct as per my knowledge!

Is it a bug or a feature is missing?

Greetings niesel

enter image description here

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

The warning originates from Pylint, which is a very helpful tool for a dynamic language with loose syntax like Python. Since you are programming in Python 2.x where print is perfectly valid, I suggest you put a file in the root of your repo named .pylintrc and use it to configure Pylint.

To disable the print warning and leave everything else to the default, enter these two lines in your .pylintrc file:

[MESSAGES CONTROL]
disable=print-statement

You will also need to tell Visual Studio Code to use your configuration file by opening your workspace or user settings and add this:

{
     "python.linting.enabled": true,
     "python.linting.pylintEnabled": true,
     "python.linting.pylintArgs": [
          "--rcfile=/path/to/.pylintrc"
     ]
}

More options

To get a good idea of available configuration options open a terminal/prompt and run this command to generate a sample configuration file:

pylint --generate-rcfile > sample_pylintrc
over 4 years ago · Santiago Trujillo Relatório

0

The problem is, that changing from print statement to print function doesn't help much. So it seems, that it is some bug in VS Code Python module (2018.1 (01 Feb 2018)), as after this update I've found the same problem in my VS Code within my old projects

bug screenshot

I've found reffered bug on their github

PS: vscode-python has changed pylint options since 2018.1. In order to return old behavior you may disable python.linting.pylintUseMinimalCheckers option for the workspace or for the userspace.

over 4 years ago · Santiago Trujillo Relatório

0

it's not an error per-se, it's just PyLint complaining about those legacy statements. PyLint will also complain about missing spaces before commas, those kind of style errors.

PyLint is there to warn you about possible problems. Your code will break when running python 3, so it warns you before it happens.

Note that print is a statement in python 2.x (which explains the message), and became a function in python 3.x.

Fix it by changing to:

print("test")

Since it's not a tuple, it works fine and does exactly the same for all versions of python, and PyLint will stop complaining.

you can also get rid of PyLint altogether: Windows 10 - Visual Studio Code - removing pylint (not sure if it's a good idea)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda