[Debug] no name in module error in pylint and flask


The following errors occur in visual code editor



It should be an import error of from urllib.request import urlopen, which I am trying to use modern python3 library. Similarly, same errors keep popping up during the bootstrap of flask server.

It can be concluded that the error is caused by the conflicts of python version, which the target of pylint and flask are both python 2.x when python 3.x libraries are imported.


For flask, I have installed the version for python3, the old version of flask will be overridden. (It can also be solved using Virtualenv)

For pylint, it can be directly selected as python3 at the bottom bar of visual code, or we can still override the old version and install pylint for python3.