简体   繁体   中英

Emacs flycheck python false postive with print()

I might spot a false positive with emacs flycheck an 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. (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.

EDIT : This is not a code error see screenshot 错误截图

EDIT 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. The problem is not with Flycheck but with your code:

 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 by default will show you exactly this.

The following would not yield any errors:

from sys import stderr

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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