Emacs flycheck python false postive with print()

233 views Asked by At

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 error screenshot

EDIT 2 :

$ python --version
Python 3.4.2
1

There are 1 answers

8
Simon Fromme On

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)

M-x flycheck-list-errors which is bound to C-c ! 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)