代码之家  ›  专栏  ›  技术社区  ›  Welgriv

Emacs flycheck python false postive with print()

  •  0
  • Welgriv  · 技术社区  · 7 年前

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

    Python运行正常,但flycheck告诉我存在语法错误。(我在示例中使用了标准错误,但它发生在任何文件描述符上)

    编辑: 这是 代码错误参见屏幕截图 error screenshot

    $ python --version
    Python 3.4.2
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Simon Fromme    7 年前

    您的代码使用语法检查器触发以下警告 python-flake8 3.5.0 )并且没有改变默认行为的配置文件。问题不在于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)
    

    M-x flycheck-list-errors 一定会 C-c ! l 默认情况下会显示这个。

    以下内容不会产生任何错误:

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