简体   繁体   English

Emacs flycheck python false正带print()

[英]Emacs flycheck python false postive with print()

I might spot a false positive with emacs flycheck an python. 我可能会发现emacs flycheck和python的误报。 This is happen when a I write in a file : 当我在文件中写入时会发生这种情况:

from sys import *
print('this is an error, like you 3:)', file = stderr)

Python run correctly but flycheck tell me that there is a syntax error. Python可以正常运行,但是flycheck告诉我存在语法错误。 (I used standard error for the example but it's happen with any file descriptor) (我在示例中使用了标准错误,但是任何文件描述符都会发生这种情况)

This is not a real problem but it's a bit boring cause flycheck don't point out any next syntax error in the buffer. 这不是一个真正的问题,但这有点无聊,因为flycheck不会指出缓冲区中的任何下一个语法错误。

EDIT : This is not a code error see screenshot 编辑:这不是代码错误,请参见屏幕截图 错误截图

EDIT 2 : 编辑2:

$ python --version
Python 3.4.2

Your code triggers the following warnings with the syntax checker python-flake8 (Version: 3.5.0 ) and no config file that alters the default behaviour. 您的代码使用语法检查器python-flake8 (版本: 3.5.0 )并且没有python-flake8默认行为的配置文件触发以下警告。 The problem is not with Flycheck but with your code: 问题不在于Flycheck,而在于您的代码:

 1   1 warning  F403   'from sys import *' used; unable to detect undefined names (python-flake8)
 2  45 warning  E251   unexpected spaces around keyword / parameter equals (python-flake8)
 2  47 warning  E251   unexpected spaces around keyword / parameter equals (python-flake8)
 2  48 warning  F405   'stderr' may be undefined, or defined from star imports: sys (python-flake8)

Mx flycheck-list-errors which is bound to Cc ! l 绑定到Cc ! l Mx flycheck-list-errors Cc ! l Cc ! l by default will show you exactly this. Cc ! l默认情况下将准确显示此信息。

The following would not yield any errors: 以下内容不会产生任何错误:

from sys import stderr

print('this is an error, like you 3:)', file=stderr)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM