-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--error-mode seems to enable --py3k errors even when the latter flag is not given #1869
Comments
What do you think of including:
from __future__ import print_function
...at the top of your file? That should appease by Python 2.7 and Pylint.
…On Wed, Feb 7, 2018 at 11:32 AM, noonedeadpunk ***@***.***> wrote:
Steps to reproduce
1. Create file with content: print("Hello, world!")
2. Launch pylint for python 2.7 with arguments "--enable=E
--reports=n" and check this file
Current behavior
As a result of check, pylint output following result:
$ /usr/bin/pylint --enable=E --reports=n test.py
No config file found, using default configuration
************* Module test
C: 1, 0: Unnecessary parens after 'print' keyword (superfluous-parens)
C: 1, 0: Missing module docstring (missing-docstring)
E: 1, 0: print statement used (print-statement)
Expected behavior
Python 2.7 doesn't require using of print() function. Moreover, when I'm
actually using print() function instead of print statement, pylint still
raises error message.
pylint --version output
$ pylint --version
No config file found, using default configuration
pylint 1.8.2,
astroid 1.6.1
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609]
Bug raised in VS Code python module, which by default uses pylint:
microsoft/vscode-python#722
<microsoft/vscode-python#722>
Also it was discussed here microsoft/vscode#43024
<microsoft/vscode#43024>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1869>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0yGmx19DG_g56K70z1gye2l9Uo6Khfks5tSfpcgaJpZM4R9RCG>
.
--
Dan Stromberg
|
Yep, it works, but it looks like a workaround. I may even replace print() with sys.stdout.write() . Nevertheless, I believe, that pylint marks usage of print() function as an error incorrectly, as it's correct usage in python. Moreover, pylint gives conflicting results: from one side parens are unnecessary for print, and from the other side print is used as statement. So if this is the only solution and this problem is well-known I would be very grateful for the reference to some PEP with recommends to use print_function from the |
print(a) works for both, but a print(a, b) does something strange on 2.x - it prints a tuple.
To 2.x print(a) is printing a parenthesized expression.
Sent from my T-Mobile 4G LTE Device
-------- Original message --------From: noonedeadpunk <notifications@github.com> Date: 2/7/18 15:07 (GMT-08:00) To: PyCQA/pylint <pylint@noreply.github.com> Cc: dstromberg <strombrg@gmail.com>, Comment <comment@noreply.github.com> Subject: Re: [PyCQA/pylint] print statement and function are treated as error
(#1869)
Yep, it works, but it looks like a workaround.
I may even replace print() with sys.stdout.write() . Nevertheless, I believe, that pylint marks usage of print() function as an error incorrectly, as it's correct usage in python. Moreover, pylint gives conflicting results: from one side parens are unnecessary for print, and from the other side print is used as statement.
So if this is the only solution and this problem is well-known I would be very grateful for the reference to some PEP with recommends to use print_function from the future, as I thought that it's ok to use print() without importing future
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/PyCQA/pylint","title":"PyCQA/pylint","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/PyCQA/pylint"}},"updates":{"snippets":[{"icon":"PERSON","message":"@noonedeadpunk in #1869: Yep, it works, but it looks like a workaround. \r\n\r\nI may even replace print() with sys.stdout.write() . Nevertheless, I believe, that pylint marks usage of print() function as an error incorrectly, as it's correct usage in python. Moreover, pylint gives conflicting results: from one side parens are unnecessary for print, and from the other side print is used as statement.\r\n\r\nSo if this is the only solution and this problem is well-known I would be very grateful for the reference to some PEP with recommends to use print_function from the __future__, as I thought that it's ok to use print() without importing future\r\n"}],"action":{"name":"View Issue","url":"#1869 (comment)"}}}
|
So what happens here is that |
Actually I was wrong. You enabled all the error checks by using |
Steps to reproduce
Current behavior
As a result of check, pylint output following result:
Expected behavior
Python 2.7 doesn't require using of print() function. Moreover, when I'm actually using print() function instead of print statement, pylint still raises error message.
pylint --version output
Bug raised in VS Code python module, which by default uses pylint: microsoft/vscode-python#722
Also it was discussed here microsoft/vscode#43024
The text was updated successfully, but these errors were encountered: