Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

563
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda