You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS Code version: 1.19.3
Python Extension version: 2018.1
Python Version: 2.7, 3.5
OS and version: OS independent
Actual behavior
pylint marks print statement and print() function are marked as error on both python 2.7 and python 3.5. This behavior appeared just after module upgrade to 2018.1
Expected behavior
pylint shouldn't mark error if using print() function on any python version and print statement on python 2.7
Steps to reproduce:
create new .py file
enter print("Hello, world!")
save file
Logs
Output from Python output panel
[pylint]E1601:print statement used (1, 1)
Output from Console window (Help->Developer Tools menu)
console.ts:123 [Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ console.ts:123
console.ts:123 [Extension Host] (node:16735) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
But it seems, that according to pylint, this message should be printed only if print is used as the statement, while it marks as an error while using print as a function.
Moreover, I couldn't reproduce this with system pylint (which is installed on the same machine, as the affected VS Code):
And if I replace print() with a statement, only "Missing module docstring (missing-docstring)" notification will stay. So this is possible only if the module uses it's own pylint, which is different version from the system one.
It seems, that it's my fault about reporting problem for python3 - pylint just hadn't re-read the file after changing Python version. So this problem is referenced only to python2.
Ivan Kurnosov (@zerkms) Yep, you're right, enabling "E" raises "print statement used". Most likely, that vscode-python used other list of enabled modules before update, as this problem appeared only after module update.
And it's pretty irritating, as all of projects are highlighted due to "print statement used". But it seems, that the problem should be addressed to the pylint.
Ivan Kurnosov (@zerkms) it seems, that this actual problem with pylint started some time ago, but only now it started to annoy in vscode. Probably you know if --enable=E (or probably some other option) was added by default with the module update?
So, from __future__ import print_function resolves problem, but it looks more like workaround, than the real solution.
Actually, something is really became wrong with pylint after module upgrade. I suppose, that the point is in the default flags for pylint.
So, when I enabled all flags locally for file, which were kindly provided by Ivan Kurnosov (@zerkms) I recieved the following result (which is absolutely correct, except print statement error, which is seemed to be really pylint problem, when -E(--error-mode) flag is used):
But if I will remove this pylint options string, all other notifications will be suppressed. If I will remove print() statement, pylint won't display suppressed problems at all.
And I am 100% sure, that these notifications were shown before the module update
So... is the only solution to have a .pylintrc file in all our project?
I think this is a good thing MattGyver (@MatthieuScarset). It's no different to other per-project configuration being present (e.g. .gitignore) and it means that the feedback in VS Code will match up with the results of running pylint from the command-line.
The only problem is that this doesn't work as of the latest release.
MattGyver (@MatthieuScarset)Rob Haswell (@robhaswell) We have some fixes rolling out in the next release to strengthen our detection of custom settings and thus turning off our simpler rules. And as for this specific problem, we are literally meeting about this specific bug in less than an hour to come up with a solution (if we can), so we just ask people be patient as we are actively working on this and aiming to release this week (assuming no more showstopping bugs crop up 😉 ).
Activity
MikhailArkhipov commentedon Feb 7, 2018
This is PyLint message. Extension simply outputs what PyLint produces. In 2.7 the message should appear according to PyLint docs:
https://pylint.readthedocs.io/en/latest/technical_reference/features.html
However, it should not appear in 3+ then. You can suppress the message in pylintrc file.
noonedeadpunk commentedon Feb 7, 2018
But it seems, that according to pylint, this message should be printed only if print is used as the statement, while it marks as an error while using print as a function.
Moreover, I couldn't reproduce this with system pylint (which is installed on the same machine, as the affected VS Code):
And if I replace print() with a statement, only "Missing module docstring (missing-docstring)" notification will stay. So this is possible only if the module uses it's own pylint, which is different version from the system one.
It seems, that it's my fault about reporting problem for python3 - pylint just hadn't re-read the file after changing Python version. So this problem is referenced only to python2.
zerkms commentedon Feb 7, 2018
Dmitriy Rabotyagov (@noonedeadpunk) run pylint with these arguments
noonedeadpunk commentedon Feb 7, 2018
Ivan Kurnosov (@zerkms) Yep, you're right, enabling "E" raises "print statement used". Most likely, that vscode-python used other list of enabled modules before update, as this problem appeared only after module update.
And it's pretty irritating, as all of projects are highlighted due to "print statement used". But it seems, that the problem should be addressed to the pylint.
zerkms commentedon Feb 7, 2018
Dmitriy Rabotyagov (@noonedeadpunk) if you report it to the pylink could you please post a link here
noonedeadpunk commentedon Feb 7, 2018
Ivan Kurnosov (@zerkms) it seems, that this actual problem with pylint started some time ago, but only now it started to annoy in vscode. Probably you know if --enable=E (or probably some other option) was added by default with the module update?
So,
from __future__ import print_functionresolves problem, but it looks more like workaround, than the real solution.zerkms commentedon Feb 7, 2018
I personally use
loggerinstead ofprint;-)noonedeadpunk commentedon Feb 8, 2018
Actually, something is really became wrong with pylint after module upgrade. I suppose, that the point is in the default flags for pylint.
So, when I enabled all flags locally for file, which were kindly provided by Ivan Kurnosov (@zerkms) I recieved the following result (which is absolutely correct, except print statement error, which is seemed to be really pylint problem, when -E(--error-mode) flag is used):

But if I will remove this pylint options string, all other notifications will be suppressed. If I will remove print() statement, pylint won't display suppressed problems at all.
And I am 100% sure, that these notifications were shown before the module update
17 remaining items
brettcannon commentedon Mar 3, 2018
It's looking like Pylint won't be fixing this before our next release, so we will probably have to add an explicit disablement of that checker.
brettcannon commentedon Mar 6, 2018
If people want to help us test our fix, please install the insiders build of the extension and make sure you have Pylint 1.8 installed.
brettcannon commentedon Mar 6, 2018
I'm re-opening the issue as you get an extraneous error from Pylint about
--disable=print-statementnot being a module ATM.brettcannon commentedon Mar 7, 2018
In case we have to list every
Eerror code manually to avoid enabling--py3kcheckers:You will notice that
E1601is not on there. This was created using https://github.com/proxy/gist.github.com/brettcannon/eff7f38a60af48d39814cbb2f33b3d1d .MatthieuScarset commentedon Mar 7, 2018
So... is the only solution to have a
.pylintrcfile in all our project?I've tried the custom setting but it's not working.
#722 (comment)
robhaswell commentedon Mar 7, 2018
I think this is a good thing MattGyver (@MatthieuScarset). It's no different to other per-project configuration being present (e.g.
.gitignore) and it means that the feedback in VS Code will match up with the results of runningpylintfrom the command-line.The only problem is that this doesn't work as of the latest release.
brettcannon commentedon Mar 7, 2018
MattGyver (@MatthieuScarset) Rob Haswell (@robhaswell) We have some fixes rolling out in the next release to strengthen our detection of custom settings and thus turning off our simpler rules. And as for this specific problem, we are literally meeting about this specific bug in less than an hour to come up with a solution (if we can), so we just ask people be patient as we are actively working on this and aiming to release this week (assuming no more showstopping bugs crop up 😉 ).
Explicit list out all E checkers for Pylint
Explicitly list out all E checkers for Pylint (#975)