Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

560
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!