sevenQu
V2EX  ›  Flask

vscode 显示[pylint] E1101:Instance of 'SQLAlchemy' has no 'Column' member

  •  
  •   sevenQu · Feb 1, 2018 · 9143 views
    This topic created in 3022 days ago, the information mentioned may be changed or developed.

    我近期在看 flask 的狗书,在第 5 张数据库的时候遇到的问题
    我使用的是 vscode 编辑器,显示错误如标题
    它会显示红线,如下图,但是我的代码应该没错,因为我执行并没有出错,希望有人帮忙解释一下
    http://ww1.sinaimg.cn/large/0060lm7Tly1fo1ah2vef3j30k90d075n.jpg

    ps:flask 的模板文件在 vscode 里好难写,不知道有没有插件推荐(自己搜过,前几个不好用啊),不想用 pycharm 因为不想破解,社区版试了一下,最后选择了 vscode

    5 replies    2018-10-27 10:29:56 +08:00
    0Y89tX3MgR4I
        1
    0Y89tX3MgR4I  
       Feb 1, 2018
    pylint 只是静态分析吧,你运行了吗,运行没问题就行
    sevenQu
        2
    sevenQu  
    OP
       Feb 1, 2018
    https://github.com/Microsoft/vscode-python/issues/50
    无法识别问题,在 github 上有解释
    try linting the python file in the terminal using pylint. 这句话怎么做?
    sevenQu
        3
    sevenQu  
    OP
       Feb 1, 2018
    @0Y89tX3MgR4I 嗯,我运行了,确实没事,我也明白为什么了,谢谢
    sevenQu
        4
    sevenQu  
    OP
       Feb 1, 2018
    @0Y89tX3MgR4I 没有智能提示和会显示红线错误,确实很别扭
    nullcoder
        5
    nullcoder  
       Oct 27, 2018   ❤️ 1
    解决方案
    https://stackoverflow.com/questions/28193025/pylint-cant-find-sqlalchemy-query-member

    Solution
    `pip install pylint-flask`
    Load the installed plugin.

    For example, if you use VS code, please edit setting.json file as follows:

    "python.linting.pylintArgs": ["--load-plugins", "pylint_flask"]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3363 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 11:21 · PVG 19:21 · LAX 04:21 · JFK 07:21
    ♥ Do have faith in what you're doing.