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

2018-02-01 22:01:00 +08:00
 sevenQu

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

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

8449 次点击
所在节点    Flask
5 条回复
0Y89tX3MgR4I
2018-02-01 22:36:53 +08:00
pylint 只是静态分析吧,你运行了吗,运行没问题就行
sevenQu
2018-02-01 22:37:47 +08:00
https://github.com/Microsoft/vscode-python/issues/50
无法识别问题,在 github 上有解释
try linting the python file in the terminal using pylint. 这句话怎么做?
sevenQu
2018-02-01 22:38:33 +08:00
@0Y89tX3MgR4I 嗯,我运行了,确实没事,我也明白为什么了,谢谢
sevenQu
2018-02-01 22:39:19 +08:00
@0Y89tX3MgR4I 没有智能提示和会显示红线错误,确实很别扭
nullcoder
2018-10-27 10:29:56 +08:00
解决方案
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"]

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/427834

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX